forked from FoundKeyGang/FoundKey
server: set file permissions after copy
This explicitly sets the file permissions to allow everyone to read files since apparently multer sometimes doesn't set the permissions we expect. Ref: FoundKeyGang/FoundKey#202 Changelog: Fixed
This commit is contained in:
parent
7f564431be
commit
2a46719f31
1 changed files with 3 additions and 1 deletions
|
@ -18,7 +18,9 @@ export class InternalStorage {
|
||||||
|
|
||||||
public static saveFromPath(key: string, srcPath: string): string {
|
public static saveFromPath(key: string, srcPath: string): string {
|
||||||
fs.mkdirSync(InternalStorage.path, { recursive: true });
|
fs.mkdirSync(InternalStorage.path, { recursive: true });
|
||||||
fs.copyFileSync(srcPath, InternalStorage.resolvePath(key));
|
const target = InternalStorage.resolvePath(key);
|
||||||
|
fs.copyFileSync(srcPath, target);
|
||||||
|
fs.chmodSync(target, 0o644);
|
||||||
return `${config.url}/files/${key}`;
|
return `${config.url}/files/${key}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue