-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Saved filename fixed so that clients display it correctly #2415 #2705
Merged
flovilmart
merged 4 commits into
parse-community:master
from
lama-buddy:extend-uploaded-filename-length
Sep 17, 2016
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4e5e3dd
increased filename length to 36 to make sure clients display correct …
lama-buddy 7ddf3e5
increased filename length to 36 to make sure clients display correct …
lama-buddy 4d8551d
added uuid prefix to saved filenames
lama-buddy e67039f
Merge branch 'extend-uploaded-filename-length' of https://github.com/…
lama-buddy 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
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.
Why not use a real UUID instead of a random hex? (32 chars + 4 dash right?)
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.
As explained in the comment, if we use a UUID, expandFilesInObject method will think the file is hosted in files.parse.com and construct the wrong URL. We want to keep the support for files.parse.com files and Parse Server created files so this keeps both working.
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.
if you look at the regex here https://github.com/ParsePlatform/parse-server/blob/e690b73bb5982cb8c8766e92c44e09f6dcd9aa99/src/Controllers/FilesController.js#L9
the separator between the UUID and the rest of the file is a
-
.IN our case we use a
_
for separating the random string and the filename. So that would still workThere 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.
That's true. So I can do something like this:
var hexstring = randomHexString(32)
var uuid = hexstring.substring(0,8) + "-" + hexstring.substring(8,12) + "-" + hexstring.substring(12,16) + "-" + hexstring.substring(16,20) + "-" + hexstring.substring(20);
filename = uuid + '_' + filename;
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.
maybe add the uuid package to generate a true UUID. (https://github.com/broofa/node-uuid)
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.
ok. will do. thanks.
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.
Thanks YOU!