sandstorm icon indicating copy to clipboard operation
sandstorm copied to clipboard

Destination webdav header missing slash

Open mnutt opened this issue 4 years ago • 1 comments

I'm running into an issue when using the Destination header to move a file. I might send something like this in the request header:

Destination: http://ui-dedd82ceddacee6aafced10c1fbe0c7b.local.sandstorm.io:6090/dav/asdfafsd/shuttle.jpg

However, when I log the destination header inside of the grain server I get: http://ui-dedd82ceddacee6aafced10c1fbe0c7b.local.sandstorm.io:6090dav/asdfafsd/shuttle.jpg (note the missing slash after the port)

It looks like it is due to this line:

https://github.com/sandstorm-io/sandstorm/blob/9e77d99187326eccc0731fba9f96249ff6d34730/src/sandstorm/web-session-bridge.c%2B%2B#L463-L464

...which seems very deliberate, so I didn't want to go ahead and make a PR without understanding why we might be removing the leading slash here? Constructing the header is just joining [basePath, destination] and the basePath has no trailing slash.

This is not an urgent issue, as for the time being I can just subtract the x-sandstorm-base-path to get the destination pathname, and add the leading slash if necessary.

mnutt avatar Sep 05 '21 19:09 mnutt

Looks like this was originally introduced in 5834c5088 (which started handling , and there is a (still present) comment in web-session.capnp that seems relevant:

https://github.com/sandstorm-io/sandstorm/blob/0811bcdc7d84ccf3c005554a7b269f984934e816/src/sandstorm/web-session.capnp#L98-L99

It looks like web-session-bridge strips out the bit of the url before the path, and it gets added back in sandstorm-http-bridge, in makeDestinationHeader -- presumably that would be the correct place to add the slash? (cc: @kentonv)

zenhack avatar Sep 05 '21 19:09 zenhack