mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
fix
This commit is contained in:
parent
64d8ef4a39
commit
d7885fd773
8
.github/labeler-config-srvaroa.yml
vendored
8
.github/labeler-config-srvaroa.yml
vendored
@ -76,8 +76,8 @@ labels:
|
|||||||
- 'app/core/src/main/resources/settings.yml.template'
|
- 'app/core/src/main/resources/settings.yml.template'
|
||||||
- 'app/core/src/main/resources/application.properties'
|
- 'app/core/src/main/resources/application.properties'
|
||||||
- 'app/core/src/main/resources/banner.txt'
|
- 'app/core/src/main/resources/banner.txt'
|
||||||
- 'scripts/png_to_webp.py'
|
- 'app/core/src/main/resources/static/python/png_to_webp.py'
|
||||||
- 'split_photos.py'
|
- 'app/core/src/main/resources/static/python/split_photos.py'
|
||||||
- 'application.properties'
|
- 'application.properties'
|
||||||
|
|
||||||
- label: 'Security'
|
- label: 'Security'
|
||||||
@ -95,8 +95,8 @@ labels:
|
|||||||
- 'app/core/src/main/java/stirling/software/SPDF/model/api/.*'
|
- 'app/core/src/main/java/stirling/software/SPDF/model/api/.*'
|
||||||
- 'app/core/src/main/java/stirling/software/SPDF/service/ApiDocService.java'
|
- 'app/core/src/main/java/stirling/software/SPDF/service/ApiDocService.java'
|
||||||
- 'app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/.*'
|
- 'app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/.*'
|
||||||
- 'scripts/png_to_webp.py'
|
- 'app/core/src/main/resources/static/python/png_to_webp.py'
|
||||||
- 'split_photos.py'
|
- 'app/core/src/main/resources/static/python/split_photos.py'
|
||||||
- '.github/workflows/swagger.yml'
|
- '.github/workflows/swagger.yml'
|
||||||
|
|
||||||
- label: 'Documentation'
|
- label: 'Documentation'
|
||||||
|
@ -6,10 +6,10 @@ repos:
|
|||||||
args:
|
args:
|
||||||
- --fix
|
- --fix
|
||||||
- --line-length=127
|
- --line-length=127
|
||||||
files: ^((\.github/scripts|scripts)/.+)?[^/]+\.py$
|
files: ^((\.github/scripts|scripts|app/core/src/main/resources/static/python)/.+)?[^/]+\.py$
|
||||||
exclude: (split_photos.py)
|
exclude: (split_photos.py)
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
files: ^((\.github/scripts|scripts)/.+)?[^/]+\.py$
|
files: ^((\.github/scripts|scripts|app/core/src/main/resources/static/python)/.+)?[^/]+\.py$
|
||||||
exclude: (split_photos.py)
|
exclude: (split_photos.py)
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: v2.4.1
|
rev: v2.4.1
|
||||||
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.ResourceLoader;
|
import org.springframework.core.io.ResourceLoader;
|
||||||
import org.springframework.core.io.support.ResourcePatternUtils;
|
import org.springframework.core.io.support.ResourcePatternUtils;
|
||||||
@ -442,6 +443,27 @@ public class GeneralUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts a file from classpath:/static/python to a temporary directory and returns the
|
||||||
|
* path.
|
||||||
|
*/
|
||||||
|
public static Path extractScript(String scriptName) throws IOException {
|
||||||
|
// 1. loade the script from classpath
|
||||||
|
ClassPathResource resource = new ClassPathResource("static/python/" + scriptName);
|
||||||
|
|
||||||
|
// 2. create a temporary directory
|
||||||
|
Path tmpDir = Files.createTempDirectory("stirling-pdf-scripts");
|
||||||
|
tmpDir.toFile().deleteOnExit();
|
||||||
|
|
||||||
|
// 3. Copy the file
|
||||||
|
Path scriptFile = tmpDir.resolve(scriptName);
|
||||||
|
try (InputStream in = resource.getInputStream()) {
|
||||||
|
Files.copy(in, scriptFile, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
return scriptFile;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isVersionHigher(String currentVersion, String compareVersion) {
|
public static boolean isVersionHigher(String currentVersion, String compareVersion) {
|
||||||
if (currentVersion == null || compareVersion == null) {
|
if (currentVersion == null || compareVersion == null) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user