cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

John D.24
New member | Level 1

I've been using the PHP SDK to save files programmatically for well over a year without issue.  However, just in the past few days a problem suddenly appeared that is throwing a fatal error.  I have updated the SDK with the current dropbox-sdk-php-1.1.6 files, with no change.

The error occurs as I make a call to 

$dbxClient->createShareableLink($objFile->fileFolder);

 

PHP Fatal error: Uncaught exception 'Dropbox\Exception_BadResponseCode' with message 'Unexpected HTTP status 301

' in /~application~/includes/dropbox-sdk/Dropbox/RequestUtil.php:256
Stack trace:
#0 /~application~/includes/dropbox-sdk/Dropbox/Client.php(1034): Dropbox\RequestUtil::unexpectedStatus(Object(Dropbox\HttpResponse))
#1 /~application~/uploadFile.php(124): Dropbox\Client->createShareableLink('//WGASC/Alvarad...')
#2 {main}
thrown in /~application~/includes/dropbox-sdk/Dropbox/RequestUtil.php on line 256

Again - this has been working just fine for months until the last few days (<1 week).

Anyone have an idea of what's going on ... and how to resolve?

Thank you in-advance.

-john

 

 

 

 

6 Replies 6

Steve M.
Dropbox Staff

You mentioned uploadFileFromString, but it looks like the error is coming from createShareableLink?

Also, I notice that the path you're passing to createShareableLink has an extra leading slash. My guess is that this is the culprit... try getting rid of that leading slash to see if the problem goes away.

John D.24
New member | Level 1

NOTE: I removed the additional '/' from the beginning of the folder name and the problem was resolved.   What is strange is that the double '/' has been working for months.

 

Steve M.
Dropbox Staff

My guess is that something changed on the Dropbox side to redirect paths with double slashes in them. (E.g. /foo//bar gets redirect to /foo/bar.) I'll make sure the right folks take a look at this.

Pankaj G.
New member | Level 1

This created a huge problem with our integration and we were scratching our head what is wrong. Finally landed here and now know the issue. Is there a way for drop box to inform the community when something of this sort changes? Lot of time gets wasted otherwise

Greg-DB
Dropbox Staff

Apologies for the inconvenience Pankaj! We of course never want to break apps, and we email and post on the blog whenever we are planning a breaking change or deprecation. This change in validation wasn't intended to be a breaking change though, so there wasn't any outreach. 

Greg-DB
Dropbox Staff

For reference, we've now reverted the behavior change, so the double slash version should work again. We do recommend only using a single slash though.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Pankaj G. New member | Level 1
  • User avatar
    Steve M. Dropbox Staff
  • User avatar
    John D.24 New member | Level 1
What do Dropbox user levels mean?