Skip to content

Commit

Permalink
Merge pull request #332 from cnescatlab/dev
Browse files Browse the repository at this point in the history
Release 4.1.2
  • Loading branch information
louisjdmartin authored Oct 12, 2022
2 parents b32babe + 526dc1f commit 93feddd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.cnes.sonar</groupId>
<artifactId>cnesreport</artifactId>
<version>4.1.2</version>
<version>4.1.3</version>
<packaging>sonar-plugin</packaging>

<name>SonarQube CNES Report</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package fr.cnes.sonar.report.exporters;

import fr.cnes.sonar.report.exceptions.BadExportationDataTypeException;
import fr.cnes.sonar.report.utils.UrlEncoder;

import java.io.File;
import java.io.FileWriter;
Expand Down Expand Up @@ -48,7 +49,7 @@ public File export(final Object data, final String path, final String filename)
final String string = (String) data;

// set relevant variables
final String filePath = String.format("%s/%s.json", path, filename);
final String filePath = String.format("%s/%s.json", path, UrlEncoder.sanitizeUrlSafe(filename));

// file to write
final File jsonFile = new File(filePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package fr.cnes.sonar.report.exporters;

import fr.cnes.sonar.report.exceptions.BadExportationDataTypeException;
import fr.cnes.sonar.report.utils.UrlEncoder;

import java.io.File;
import java.io.FileWriter;
Expand Down Expand Up @@ -48,7 +49,7 @@ public File export(final Object data, final String path, final String filename)
final String string = (String) data;

// set relevant variables
final String filePath = String.format("%s/%s.xml", path, filename);
final String filePath = String.format("%s/%s.xml", path, UrlEncoder.sanitizeUrlSafe(filename));

// file to write
final File xmlFile = new File(filePath);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/fr/cnes/sonar/report/utils/UrlEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ public static String urlEncodeString(String pString) {

return encodedString;
}
public static String sanitizeUrlSafe(String filename) {
return filename.replaceAll("[^a-zA-Z0-9.-]", "_");
}

}

0 comments on commit 93feddd

Please sign in to comment.