server icon indicating copy to clipboard operation
server copied to clipboard

Uploading files to an AAS does not update the underlying package

Open HansG89 opened this issue 1 year ago • 1 comments

Branch: masterV3

When using the REST API to upload attachments or thumbnails into an existing AAS this does not update the underlying package. We always need to download the package and afterwards upload it again (using the PUT /packages/{packageID} endpoint) to make the changes permanent.

Is this the intendend behaviour or should adding files via REST API automatically update the stored AASX package?

Edit:

There is a bug when editing an AASX with the PUT package endpoint after a change was done to the original AASX file. I think a proper fix should be changing this line

https://github.com/admin-shell-io/aasx-server/blob/3abf7f1817bf5118293e1b2b7daddb864b1fac71/src/IO.Swagger.V1RC03/Services/AasxFileServerInterfaceService.cs#L194

into this

var originalFile = _envFileNames[packageIndex];

HansG89 avatar Mar 21 '23 14:03 HansG89

We are having the same issue at the moment when using the AASX Server. We want to create an AAS via the API. And then upload a file to one of its submodel elements via the PUT /attachment/ endpoint. It works only with some work arounds

This flow doesn't work:

  • Create new AAS and Submodel for this AAS via the API
  • PUT /attachment to one of it File submodel elements -> Return 204, seems to be OK
  • GET /attachment to check if the file is really on the sever -> fails

This flow works:

  • Create new AAS and Submodel for this AAS via the API
  • Download the AASX file of this created AAS e.g. via Blazor UI or GET /packages/{packageID} endpoint
  • PUT /attachment to one of it File submodel elements -> Return 204
  • GET /attachment to check if the file is really on the sever -> Now the download works

But as described above the underlying AASX file in the server is not updated.

To update it we need to do another workaround.

  • Download the AASX file via Blazor UI or GET /packages/{packageID} endpoint
  • the downloaded AASX file contains the previously uploaded file (PUT /attachment)
  • Upload the AASX file to the server by using the PUT /packages/{packageID} endpoint

Now the underlying AASX file on the server is updated.

Working with attachments on AAS created via the API should be supported and the underlying AASX files should be updated also directly.

MMuellerMitsubishi avatar Jan 19 '24 13:01 MMuellerMitsubishi