fix(directories): inputs absolute paths into db

This commit is contained in:
2026-06-23 21:31:45 +01:00
parent 5651aa4ce9
commit 8b299dc4fa
3 changed files with 21 additions and 8 deletions

View File

@@ -77,6 +77,18 @@ public class DirectoryService {
return streamFolder;
}
public Path relativisePath(Path path) {
Path media = Path.of(usersDir).toAbsolutePath();
Path newPath = path.toAbsolutePath();
return media.relativize(newPath);
}
public Path resolvePath(String path) {
Path media = Path.of(usersDir).toAbsolutePath();
Path newPath = Path.of(path);
return media.resolve(newPath);
}
public void saveMultipartFile(Path path, MultipartFile multipartFile) throws IOException {
Files.createDirectories(path.getParent());
Files.copy(multipartFile.getInputStream(), path, StandardCopyOption.REPLACE_EXISTING);