mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-04 23:48:42 +01:00
Replace '+' with ' ' in exported file paths.
Affects issues: - Fixed #1278
This commit is contained in:
parent
6e4dce2553
commit
d2b3b86154
@ -16,14 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.delivery.export;
|
package com.djrapitops.plan.delivery.export;
|
||||||
|
|
||||||
|
import com.djrapitops.plan.delivery.rendering.html.Html;
|
||||||
import com.djrapitops.plan.storage.file.Resource;
|
import com.djrapitops.plan.storage.file.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.OpenOption;
|
import java.nio.file.OpenOption;
|
||||||
@ -72,15 +71,11 @@ abstract class FileExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String toFileName(String resourceName) {
|
String toFileName(String resourceName) {
|
||||||
try {
|
return StringUtils.replaceEach(
|
||||||
return StringUtils.replaceEach(
|
Html.encodeToURL(resourceName),
|
||||||
URLEncoder.encode(resourceName, "UTF-8"),
|
new String[]{".", "%2F", "%20"},
|
||||||
new String[]{".", "%2F"},
|
new String[]{"%2E", "-", " "}
|
||||||
new String[]{"%2E", "-"}
|
);
|
||||||
);
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new IllegalStateException("Unexpected: UTF-8 encoding not supported", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user