mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[web] Try various file extensions for preview urls (#11467)
GitOrigin-RevId: 1dd8001c337b10450c83a58b4ab0904867a21250
This commit is contained in:
parent
fd90261313
commit
83e4a2fab6
1 changed files with 15 additions and 4 deletions
|
@ -293,10 +293,21 @@ export default FileTreeManager = class FileTreeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
getPreviewUrlByPath(path) {
|
getPreviewUrlByPath(path) {
|
||||||
const entity = this.findEntityByPath(path)
|
for (const extension of [
|
||||||
return entity
|
'',
|
||||||
? `/project/${this.$scope.project._id}/file/${entity.id}`
|
'.png',
|
||||||
: null
|
'.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) {
|
_findEntityByPathInFolder(folder, path) {
|
||||||
|
|
Loading…
Reference in a new issue