mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Don't allow opening of files we know cannot be edited; closes #2286
This commit is contained in:
@@ -19,7 +19,6 @@ export const rawDataToFileObject = (data: FractalResponseData): FileObject => ({
|
||||
size: Number(data.attributes.size),
|
||||
isFile: data.attributes.is_file,
|
||||
isSymlink: data.attributes.is_symlink,
|
||||
isEditable: data.attributes.is_editable,
|
||||
mimetype: data.attributes.mimetype,
|
||||
createdAt: new Date(data.attributes.created_at),
|
||||
modifiedAt: new Date(data.attributes.modified_at),
|
||||
@@ -39,6 +38,19 @@ export const rawDataToFileObject = (data: FractalResponseData): FileObject => ({
|
||||
'application/zip', // .zip
|
||||
].indexOf(this.mimetype) >= 0;
|
||||
},
|
||||
|
||||
isEditable: function () {
|
||||
if (this.isArchiveType() || !this.isFile) return false;
|
||||
|
||||
const matches = [
|
||||
'application/jar',
|
||||
'application/octet-stream',
|
||||
'inode/directory',
|
||||
/^image\//,
|
||||
];
|
||||
|
||||
return matches.every(m => !this.mimetype.match(m));
|
||||
},
|
||||
});
|
||||
|
||||
export const rawDataToServerBackup = ({ attributes }: FractalResponseData): ServerBackup => ({
|
||||
|
||||
Reference in New Issue
Block a user