Skip to content

Commit

Permalink
Dev (#190)
Browse files Browse the repository at this point in the history
Co-authored-by: adrrossi <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: adrrss <[email protected]>
Co-authored-by: SMANUM <[email protected]>
Co-authored-by: LuciaM1 <[email protected]>
Co-authored-by: GiacomoB <[email protected]>
Co-authored-by: Simone Munao <[email protected]>
Co-authored-by: LuciaM1 <[email protected]>
Co-authored-by: ElisKina-dev <[email protected]>
Co-authored-by: ElisKina-dev <[email protected]>
Co-authored-by: Gabriele Maiocchi <[email protected]>
Co-authored-by: Giacomo Brancazi <[email protected]>
  • Loading branch information
13 people authored Sep 25, 2024
1 parent bfb076e commit 060f371
Show file tree
Hide file tree
Showing 6 changed files with 41,077 additions and 40,999 deletions.
12 changes: 6 additions & 6 deletions _TMP/coverage-results.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

# Coverage Report: JaCoCo

* S3PreSignerLocalTest (QuarkusTest)
* IntegrationTest (QuarkusTest)


| Outcome | Value |
|-------------------------|---------------------------------------------------------------------|
| Code Coverage % | 91.82% |
| :heavy_check_mark: Number of Lines Covered | 2278 |
| :x: Number of Lines Missed | 203 |
| Total Number of Lines | 2481 |
| Code Coverage % | 91.79% |
| :heavy_check_mark: Number of Lines Covered | 2282 |
| :x: Number of Lines Missed | 204 |
| Total Number of Lines | 2486 |


## Details:
Expand Down Expand Up @@ -902,7 +902,7 @@
#### Lines Missed:
- Line #143
- Line #158
```
} catch (IOException e) {
```
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v1.28.0
version: v1.28.0-dev.3
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>it.gov.pagopa</groupId>
<artifactId>atm-layer-model</artifactId>
<version>1.28.0</version>
<version>1.28.0-dev.3</version>
<name>atm-layer-model</name>
<properties>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,40 @@ public static String toHexString(byte[] hash) {

public static File fromStringToFile(String fileBase64) {
try {

byte[] decodedBytes = Base64.getDecoder().decode(fileBase64);

Path tempDir = Files.createTempDirectory("multipleUpload");
String secureDirPath = System.getProperty("java.io.tmpdir") + "/mySecureDirectory";
File secureDir = new File(secureDirPath);
if (!secureDir.exists() && !secureDir.mkdirs()) {
throw new IOException("Impossibile creare la directory sicura.");
}

Path tempFilePath;

if (SystemUtils.IS_OS_UNIX) {
Set<PosixFilePermission> permissions = EnumSet.of(
Set<PosixFilePermission> dirPermissions = EnumSet.of(
PosixFilePermission.OWNER_READ,
PosixFilePermission.OWNER_WRITE,
PosixFilePermission.OWNER_EXECUTE
);
java.nio.file.Files.setPosixFilePermissions(secureDir.toPath(), dirPermissions);
}

File tempFile;

if (SystemUtils.IS_OS_UNIX) {

Set<PosixFilePermission> filePermissions = EnumSet.of(
PosixFilePermission.OWNER_READ,
PosixFilePermission.OWNER_WRITE,
PosixFilePermission.OWNER_EXECUTE
);
FileAttribute<Set<PosixFilePermission>> fileAttributes = PosixFilePermissions.asFileAttribute(permissions);

tempFilePath = Files.createTempFile(tempDir, "tempfile", ".tmp", fileAttributes);
tempFile = File.createTempFile("tempfile", ".tmp", secureDir);
java.nio.file.Files.setPosixFilePermissions(tempFile.toPath(), filePermissions);
} else {
tempFilePath = Files.createTempFile(tempDir, "tempfile", ".tmp");

File tempFile = tempFilePath.toFile();
tempFile = File.createTempFile("tempfile", ".tmp", secureDir);

boolean readable = tempFile.setReadable(true, true);
boolean writable = tempFile.setWritable(true, true);
Expand All @@ -132,11 +147,11 @@ public static File fromStringToFile(String fileBase64) {
}
}

try (FileOutputStream fos = new FileOutputStream(tempFilePath.toFile())) {
try (FileOutputStream fos = new FileOutputStream(tempFile)) {
fos.write(decodedBytes);
}

return tempFilePath.toFile();
return tempFile;
} catch (IllegalArgumentException e) {
log.error("Errore nella decodifica del Base64: " + e.getMessage());
throw new AtmLayerException("Errore nella decodifica del File Base64", Response.Status.NOT_ACCEPTABLE, AppErrorCodeEnum.FILE_DECODE_ERROR);
Expand Down
Loading

0 comments on commit 060f371

Please sign in to comment.