Repository navigation
POST does not error in multiuser mode - #1241
Conversation
RubenVerborgh
left a comment
There was a problem hiding this comment.
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 |
| 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.
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.
michielbdejong
left a comment
There was a problem hiding this comment.
signing this off as discussed f2f with @RubenVerborgh
Fix for #1228