Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attachment Names containing slashes, won't work correctly #4

Open
lennart opened this issue Dec 17, 2009 · 1 comment
Open

Attachment Names containing slashes, won't work correctly #4

lennart opened this issue Dec 17, 2009 · 1 comment

Comments

@lennart
Copy link

lennart commented Dec 17, 2009

When putting standalone attachments to a document that are named like "folder/filename.txt" the CGI.escape escapes the slashes. This way you cannot produce paths like http://host/dbname/doc_id/folder/filename.txt which would be great since couchdb itself supports it (while futon fails).

I fiddled a bit with the escaping of attachment names, but now a single test is failing
"POST document with attachment (with funky name)" within the database_spec.rb (specifically line 417, when fetching the attachment by name).

I don't know how to fix this without breaking compatiblity with other stuff.

Any suggestions?

@lennart
Copy link
Author

lennart commented Dec 17, 2009

uum, I think it might have something to do with double escaping the attachment name in your current version.

url_for_attachment does it, while put_attachment does it as well, which then passes the escaped name to url_for_attachment. This way "folder/text.txt" will be saved as "folder%2Ftext.txt", which should not be what is expected, since fetch_attachment will fail to fetch "folder/text.txt"

I'll send you a pull request as soon as I committed the change to my fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant