-
Notifications
You must be signed in to change notification settings - Fork 374
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
[ui-storagebrowser] fixes the preview for non-text files #3981
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,7 +130,7 @@ | |
height: 90%; | ||
} | ||
|
||
.preview__unsupported { | ||
.preview__compressed { | ||
font-size: vars.$font-size-lg; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,9 +64,10 @@ export const getFileMetaData = (t: TFunction, fileStats: FileStats): MetaData[][ | |
}; | ||
|
||
export const getFileType = (fileName: string): SupportedFileTypes => { | ||
const fileExtension = fileName?.split('.')?.pop()?.toLowerCase(); | ||
if (!fileExtension) { | ||
return SupportedFileTypes.OTHER; | ||
for (const fileExtension in SUPPORTED_FILE_EXTENSIONS) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove the split on "." lower case transformation? This seems less robust given that this function still receives the complete file name. A file called "testpng" and that is lacking a proper file type will now be assumed to be a png file just because it has it in the name at the end. Also "test.PNG" which should be matched won't be matched. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The older logic failed to handle file extensions with multiple dots (e.g., There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have also updated the logic to accomodate the |
||
if (fileName.endsWith(fileExtension)) { | ||
return SUPPORTED_FILE_EXTENSIONS[fileExtension]; | ||
} | ||
} | ||
return SUPPORTED_FILE_EXTENSIONS[fileExtension] ?? SupportedFileTypes.OTHER; | ||
return SupportedFileTypes.OTHER; | ||
}; |
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 don't we mock this now?