urlToRelativePath() in Adapters seems wrong if express mountpoint is not / #6
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sciactive/nephele#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi, first off, thanks for the great module!
The code works fine when mounted on
/.I was trying to mount nephele in a subpath on express:
This in turn will, as expected, hit https://github.com/sciactive/nephele/blob/master/packages/adapter-file-system/src/Adapter.ts#L87 in various places.
The issue is, that the url in express.js would already have the mountpoint (ie baseurl) removed from the path when hitting nephele. So the check for path having baseUrl fails. Skipping that prefix check and also removing the subsequent
.substring(decodeURIComponent(baseUrl.pathname).length)will fix the issue.Further code handles listing and at least retrieving files and contents fine, but after some debugging, I couldn't quite find how the absolute paths (which are wrong, as they contain the mountpoint) are constructed. Writing files does not work as the absolute path ends up being wrong.
Maybe I am hitting some unsupported path here, but should nephele work with the filesystem adapter on an express mountpoint in the first place?
Happy to do further debugging if this is not easily reproducible or I have some more pointers in the right direction.
I'm going to look into this today. Thank you for the report.
Fixed! I used
originalUrlfrom Express instead ofurl.Awesome, thank you very much!