Skip to content

Commit

Permalink
fixed file upload bug and corresponding test (#329)
Browse files Browse the repository at this point in the history
* fixed file upload bug and corresponding test

* additional fix with aasx upload
  • Loading branch information
M-Damm authored Jul 31, 2023
1 parent 9b7f143 commit 16e2362
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void uploadNestedFiles(IIdentifier aasIdentification, AASXToMetamodelCon

private void uploadFileInSubmodelElement(IIdentifier aasIdentification, AASXToMetamodelConverter converter, File submodelElement, String submodelElementPath) {
try {
getAASProvider(aasIdentification).createValue(submodelElementPath + "/File/upload", converter.retrieveFileInputStream((String) submodelElement.getValue()));
getAASProvider(aasIdentification).createValue(submodelElementPath + "/upload", converter.retrieveFileInputStream((String) submodelElement.getValue()));
} catch (InvalidFormatException | IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private boolean endsWithFileUpload(String[] splitted) {

private String getFileIdShortFromSplittedPath4FileUpload(String[] splitted) {
String idShort = "";
for (int i = 1; i < splitted.length - 2; i++) {
for (int i = 1; i < splitted.length - 1; i++) {
idShort = concatFileIdShortPath(splitted, idShort, i);
}
return idShort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private CloseableHttpResponse uploadDummyFileToSubmodelElement(String submodelEl

HttpPost uploadFile = new HttpPost(
API_URL + "/basyx.examples.test/aas/submodels/test_sm/submodel/submodelElements/"
+ submodelElementIdShort + "/File/upload");
+ submodelElementIdShort + "/upload");
MultipartEntityBuilder builder = MultipartEntityBuilder.create();

builder.addPart("file", new FileBody(file));
Expand Down

0 comments on commit 16e2362

Please sign in to comment.