GUACAMOLE-1536: return file size and file permission information when uploading files and displaying file directories#754
Open
iamsee wants to merge 2 commits intoapache:mainfrom
Open
GUACAMOLE-1536: return file size and file permission information when uploading files and displaying file directories#754iamsee wants to merge 2 commits intoapache:mainfrom
iamsee wants to merge 2 commits intoapache:mainfrom
Conversation
… uploading files and displaying file directories
GUACAMOLE-1536: return file size and file permission information when…
mike-jumper
requested changes
Aug 31, 2022
Comment on lines
+358
to
+366
| var Ow_R = 256; | ||
| var Ow_W = 128; | ||
| var Ow_X = 64; | ||
| var Gp_R = 32; | ||
| var Gp_W = 16; | ||
| var Gp_X = 8; | ||
| var Ot_R = 4; | ||
| var Ot_W = 2; | ||
| var Ot_X = 1; |
Contributor
There was a problem hiding this comment.
- These should be defined (and documented) as constants: https://guacamole.apache.org/guac-style/#comments-and-documentation
- These should be named according to constant naming convention (
UPPERCASE_WITH_UNDERSCORES): https://guacamole.apache.org/guac-style/#naming
Comment on lines
+368
to
+413
| let res = ''; | ||
| if ((permission & Ow_R) === Ow_R) { | ||
| res += 'r'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Ow_W) === Ow_W) { | ||
| res += 'w'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Ow_X) === Ow_X) { | ||
| res += 'x'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Gp_R) === Gp_R) { | ||
| res += 'r'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Gp_W) === Gp_W) { | ||
| res += 'w'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Gp_X) === Gp_X) { | ||
| res += 'x'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Ot_R) === Ot_R) { | ||
| res += 'r'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Ot_W) === Ot_W) { | ||
| res += 'w'; | ||
| } else { | ||
| res += '-'; | ||
| } | ||
| if ((permission & Ot_X) === Ot_X) { | ||
| res += 'x'; | ||
| } else { | ||
| res += '-'; | ||
| } |
Contributor
There was a problem hiding this comment.
There's got to be a more readable way to do this. Perhaps you can structure things as a loop and avoid this kind of brute-force list?
Comment on lines
+150
to
+161
| // try deserialization fileJSON String to fileObject | ||
| var size = 0; | ||
| var permission = null; | ||
| try { | ||
| var fileObj = JSON.parse(mimetypes[name]) | ||
| size = fileObj.size || 0; | ||
| if (fileObj.perm) { | ||
| permission = ManagedFilesystem.permissionTranslate(fileObj.perm); | ||
| } | ||
| } catch (e) { | ||
| return false; | ||
| } |
Contributor
There was a problem hiding this comment.
Why? These values do not appear to be used anywhere.
| permission = ManagedFilesystem.permissionTranslate(fileObj.perm); | ||
| } | ||
| } catch (e) { | ||
| return false; |
Contributor
There was a problem hiding this comment.
Why? $evalAsync() is not documented as doing anything with the return value of the provided callback.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
apache/guacamole-server#367