-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
refactor: move OC.MimeType to src and add vitest unit tests
#55524
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
Conversation
c731157 to
b94a1cd
Compare
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
b94a1cd to
7bda1cd
Compare
szaimen
left a comment
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 (window.OCA.Theming && gotIcon === null) { | ||
| path = generateUrl('/apps/theming/img/core/filetypes/') | ||
| path += getMimeTypeIcon(mimeType, window.OC.MimeTypeList.files) | ||
| gotIcon = true | ||
| } | ||
|
|
||
| // If we do not yet have an icon fall back to the default | ||
| if (gotIcon === null) { | ||
| path = generateUrl('/core/img/filetypes/') | ||
| path += getMimeTypeIcon(mimeType, window.OC.MimeTypeList.files) | ||
| } |
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.
It is not only moving the function but also changing it
(using suggestion just to show a diff)
| if (window.OCA.Theming && gotIcon === null) { | |
| path = generateUrl('/apps/theming/img/core/filetypes/') | |
| path += getMimeTypeIcon(mimeType, window.OC.MimeTypeList.files) | |
| gotIcon = true | |
| } | |
| // If we do not yet have an icon fall back to the default | |
| if (gotIcon === null) { | |
| path = generateUrl('/core/img/filetypes/') | |
| path += getMimeTypeIcon(mimeType, window.OC.MimeTypeList.files) | |
| } | |
| if (OCA.Theming && gotIcon === null) { | |
| path = OC.generateUrl('/apps/theming/img/core/filetypes/') | |
| path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files) | |
| gotIcon = true | |
| } | |
| // If we do not yet have an icon fall back to the default | |
| if (gotIcon === null) { | |
| path = OC.getRootPath() + '/core/img/filetypes/' | |
| path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files) | |
| } |
But generateUrl cannot be used here.
/apps/theming/img/- is a PHP route managed by a controller- '/core/img/filetypes/' - is a static file path
In the first case we need to include index.php when no rewrite. But in the second adding index.php breaks the path to the icon.
/index.php/core/img/filetypes/file.svg is not correct.
It must be either imagePath or generateFilePath, or getRootPath like in the original version. But it cannot be generateUrl
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.
cc @susnux
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.
fixed in #55916
Summary
One step to get rid of Karma tests (aka "jsunit").
Checklist
3. to review, feature component)stable32)