-
-
Notifications
You must be signed in to change notification settings - Fork 371
add an unified "blob" cache #1366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…void generating the scaled logo every time
public File getFile(String section, String id, Supplier<File> supplier) { | ||
var resourcePath = getBlobDir(section).resolve(id); | ||
checkPath(resourcePath, section); | ||
if (Files.exists(resourcePath)) { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
var dir = getBlobDir(section); | ||
try { | ||
Files.createDirectories(dir); | ||
Files.move(tmpFile.toPath(), resourcePath, StandardCopyOption.ATOMIC_MOVE); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
Files.move(tmpFile.toPath(), resourcePath, StandardCopyOption.ATOMIC_MOVE); | ||
return Files.newInputStream(resourcePath); // second try... | ||
} | ||
return new FileInputStream(fileBlobCacheManager.getFile(FILE_SECTION, id, () -> repository.file(id))); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
|
||
|
||
public FileBlobCacheManager(Environment environment) { | ||
this.cacheDir = Optional.ofNullable(environment.getProperty("alfio.cache-dir")).orElse(System.getProperty("java.io.tmpdir")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if (Files.exists(resourcePath)) { | ||
return resourcePath.toFile(); | ||
} | ||
log.info("Cache not hit for file {}", id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better log cache miss at DEBUG or TRACE level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to debug
public File getFile(String section, String id, Supplier<File> supplier) { | ||
var resourcePath = getBlobDir(section).resolve(id); | ||
checkPath(resourcePath, section); | ||
if (Files.exists(resourcePath)) { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
|
with a configurable "directory", used by file upload, font and images for passkit.