This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Added "removeRootDir" option to directory uploads #32
Merged
mrcnski
merged 7 commits into
NebulousLabs:master
from
Delivator:dirupload-remove-root-opt
Jul 8, 2020
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
942f166
Added "removeRootDir" option to directory uploads
Delivator 5863eb1
Normalize path before passing to walkDirectory
Delivator f572b85
Cleaned up code
Delivator fe7c9dc
Renamed removeRootDir to removeBaseDir
Delivator 91d0df3
Removed "removeBaseDir" as an option and set to remove base by default
Delivator d4fbfc3
Merge branch 'master' into dirupload-remove-root
08f60e0
Fix test failures
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you normalize the path before it gets passed to
walkDirectory
? I'm afraid thatwalkDirectory
might otherwise return non-normalized paths, in which case thisreplace
call wouldn't work.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.
walkDirectory
usespath.join()
which returns a normalized path so I think this is unnecessary?See https://nodejs.org/api/path.html#path_path_join_paths
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.
You're right, but I would still feel more comfortable normalizing before we pass
path
into a different function. Maybe it's okay now but we are making assumptions aboutwalkDirectory
which could change. I like sanitizing inputs as soon as possible in a function but I'll leave it up to you.