Skip to content

Commit 707d185

Browse files
author
Derek Wasinger
committed
encoding fix for update file
1 parent 0c07491 commit 707d185

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/main/java/com/redhat/labs/omp/service/FileService.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,23 @@ public Optional<File> updateFile(Integer projectId, String filePath, File file)
6767

6868
Optional<File> optional = Optional.empty();
6969

70-
File updatedFile = gitLabService.updateFile(projectId, filePath, file);
70+
try {
71+
72+
// encode file
73+
EncodingUtils.encodeFile(file);
74+
75+
// update file
76+
File updatedFile = gitLabService.updateFile(projectId, filePath, file);
77+
78+
// decode file
79+
EncodingUtils.decodeFile(updatedFile);
7180

72-
if (null != updatedFile) {
73-
optional = Optional.of(updatedFile);
81+
if (null != updatedFile) {
82+
optional = Optional.of(updatedFile);
83+
}
84+
85+
} catch (UnsupportedEncodingException e) {
86+
return optional;
7487
}
7588

7689
return optional;

0 commit comments

Comments
 (0)