Please describe the problem.

When doing an export to a WebDAV remote, git-annex chokes on directory that have the # character in it, presumably because it has special meaning in HTTP.

What steps will reproduce the problem?

Roughly, setup a WebDAV remote:

WEBDAV_USERNAME=anarcat WEBDAV_PASSWORD=REDACTED git annex initremote webdav type=webdav url=https://example.net/nextcloud/remote.php/webdav/Photos/ encryption=none exporttree=yes

Create a directory with a pound sign in it, and export it:

mkdir -p pictures/foo#1 ; touch pictures/foo#1/test; git annex add pictures ; git commit -myolo
git annex export master:pictures --to webdav

What version of git-annex are you using? On what operating system?

7.20181211-2 on Debian buster, from Debian packages.

Please provide any additional information below.

Here's part of the output from the of the original export command:

[...]
export lib3.net documentation/photo/IMG_0636.JPG 
ok                                
export lib3.net documentation/radio/Antenna #1/20101107_002.jpg 
failed                            
[...]

Trying to export again retries only those but still fails:

$ git annex export master:pictures --to webdav
export lib3.net documentation/radio/Antenna #1/20101107_002.jpg 
failed                            
[...]

I have since then renamed the evil directory to remove the pound sign. But then export tries to rename it and still fails:

$ git annex export master:pictures --to lib3.net
rename lib3.net documentation/radio/Antenna #1/20101107_005.jpg -> .git-annex-tmp-content-SHA256E-s53186--07c80575cc0fa2b902fd0828f4b4ce0b12af7be94721a1e50134ec78bb67bc2e.jpg 
  rename failed; deleting instead
[...]

... and it then proceeds to upload the renamed files correctly:

[...]
export lib3.net documentation/radio/antenna-1/20101107_002.jpg 
ok                                
[...]

The log doesn't show it, but delete also fails, as a new export run will try to rename the old files again, and fail.

It wouldn't be so bad if git-annex would fail to upload to a webdav repo and just force the user to use sane filenames. The problem is it doesn't recover when the user does fix its shit... ;)

Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)

I'm running out of ideas here, to be honest. I've certainly had a lot of "luck" running git-annex before, but as others have said, "there's no such thing as luck" and the reason this whole thing works at all is because you work so hard on making it. So: thanks again! --anarcat

fixed --Joey