1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 02:42:47 +00:00

Change view image in encrypted libraries (#6952)

* change-view-image-in-encrypted-libraries

* fix warnings
This commit is contained in:
Michael An
2024-10-28 11:53:44 +08:00
committed by GitHub
parent 0d877b2287
commit f8a0ad52a6
3 changed files with 37 additions and 19 deletions

View File

@@ -184,14 +184,24 @@ class DirentListView extends React.Component {
prepareImageItem = (item) => {
const name = item.name;
const repoID = this.props.repoID;
const repoEncrypted = this.props.currentRepoInfo.encrypted;
const path = Utils.encodePath(Utils.joinPath(this.props.path, name));
const fileExt = name.substr(name.lastIndexOf('.') + 1).toLowerCase();
const isGIF = fileExt === 'gif';
const src = `${siteRoot}repo/${repoID}/raw${path}`;
let thumbnail = '';
if (repoEncrypted || isGIF) {
thumbnail = src;
} else {
thumbnail = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`;
}
return {
'name': name,
name,
thumbnail,
src,
'url': `${siteRoot}lib/${repoID}/file${path}`,
'thumbnail': `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForOriginal}${path}`,
'src': `${siteRoot}repo/${repoID}/raw${path}`,
'downloadURL': `${fileServerRoot}repos/${repoID}/files${path}/?op=download`,
'downloadURL': `${fileServerRoot}repos/${repoID}/files${path}/?op=download`
};
};