-
Notifications
You must be signed in to change notification settings - Fork 304
POST does not error in multiuser mode #1241
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relative path is too prone to errors (relative to what)? It bypasses the check that uncovered this error. ResourceMapper only does absolute paths for a good reason.
getAvailablePath should take an absolute container URI, create a new URI, then ask ResourceMapper to turn that into a file path, then check whether that path exists.
Extending ResourceMapper leaks internal knowledge, which caused bugs in the past.
@RubenVerborgh I took your suggestions into account and refactored |
lib/ldp.js
Outdated
getAvailablePath (host, containerURI, { slug = uuid.v1(), extension }) { | ||
const path = slug + extension | ||
async getAvailableUrl (hostname, containerURI, { slug = uuid.v1(), extension }) { | ||
const fileName = slug + extension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to give encoding problems.
Here's what we will need to do. We need to do all operations fully in URL space (expect for the one "does the file exist already?" check, for which we convert to file space).
- Construct the full URL of the target resource.
- Map it to a filename with
mapUrlToFile
. - Check if the file exists.
- If it exists, generate a new full URL (with
uuid
). - Return the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signing this off as discussed f2f with @RubenVerborgh
Fix for #1228