You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
fix(server): only allow absolute import paths (#13642)
fix: only allow absolute paths
This commit is contained in:
committed by
GitHub
parent
56bebd01df
commit
b411e30796
@ -633,6 +633,29 @@ describe('/libraries', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should fail if path isn't absolute", async () => {
|
||||
const pathToTest = `relative/path`;
|
||||
|
||||
const cwd = process.cwd();
|
||||
// Create directory in cwd
|
||||
utils.createDirectory(`${cwd}/${pathToTest}`);
|
||||
|
||||
const response = await utils.validateLibrary(admin.accessToken, library.id, {
|
||||
importPaths: [pathToTest],
|
||||
});
|
||||
|
||||
utils.removeDirectory(`${cwd}/${pathToTest}`);
|
||||
|
||||
expect(response.importPaths?.length).toEqual(1);
|
||||
const pathResponse = response?.importPaths?.at(0);
|
||||
|
||||
expect(pathResponse).toEqual({
|
||||
importPath: pathToTest,
|
||||
isValid: false,
|
||||
message: expect.stringMatching('Import path must be absolute, try /usr/src/app/relative/path'),
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail if path is a file', async () => {
|
||||
const pathToTest = `${testAssetDirInternal}/albums/nature/el_torcal_rocks.jpg`;
|
||||
|
||||
|
Reference in New Issue
Block a user