consecutive slash suppression in boto

129 views
Skip to first unread message

Michael Schwartz

unread,
Jan 4, 2012, 3:10:02 PM1/4/12
to boto...@googlegroups.com
Hi,

At present AWSAuthConnection.get_path() suppresses consecutive slashes, which causes problems for gsutil users who attempt to operate on objects created via libraries that don't do this suppression (e.g., they create an object "x//y" with one of those other libs, and then when they try to delete it using gsutil, boto turns the key name into "x/y", which results in a key not found error).

Since I believe there are systems/use cases that depend on the current behavior, I propose adding an optional suppressConsecSlashes param that defaults to False. Does anyone have comments/suggestions about this?

Thanks,

Mike

Mitchell Garnaat

unread,
Jan 5, 2012, 12:35:57 PM1/5/12
to boto...@googlegroups.com
Hi Mike -

I definitely think this is a flaw in boto.  There is logic that is trying to suppress multiple slashes between the hostname (and possibly path) and the actual key but the actual key should be opaque to boto and it really shouldn't be messing around with it at all.

Ideally, I would like to see this fixed as part of an overall refactoring/cleanup of the code in connection.py and auth.py but that's a big job and one that I probably won't be able to get to right away.  So, I'm not opposed to the change you propose as long as the default behavior is to function as it does now.

Mitch

Michael Schwartz

unread,
Jan 18, 2012, 5:20:46 PM1/18/12
to boto...@googlegroups.com
Hi Mitch,

I implemented the proposal discussed below, for optionally disabling consecutive slash suppression in boto. If you or anyone else in boto-dev would like to review before I commit it please take a look at http://codereview.appspot.com/5555050/

Note that I didn't try to propagate the new suppress_consec_slashes param to all calling paths -- just the ones I needed to get the desired behavior in gsutil. I could propagate to all if you like; I chose not to in order to avoid adding more optional parameters in paths where it's not currently needed; someone could always add them later if needed.

Thanks,

Mike
Reply all
Reply to author
Forward
0 new messages