[web] Try various file extensions for preview urls (#11467)

GitOrigin-RevId: 1dd8001c337b10450c83a58b4ab0904867a21250
This commit is contained in:
Mathias Jakobsen 2023-01-26 10:45:05 +00:00 committed by Copybot
parent fd90261313
commit 83e4a2fab6

View file

@ -293,10 +293,21 @@ export default FileTreeManager = class FileTreeManager {
}
getPreviewUrlByPath(path) {
const entity = this.findEntityByPath(path)
return entity
? `/project/${this.$scope.project._id}/file/${entity.id}`
: null
for (const extension of [
'',
'.png',
'.jpg',
'.jpeg',
'.PNG',
'.JPG',
'.JPEG',
]) {
const entity = this.findEntityByPath(path + extension)
if (entity) {
return `/project/${this.$scope.project._id}/file/${entity.id}`
}
}
return null
}
_findEntityByPathInFolder(folder, path) {