I recently noticed that the https://proxy.golang.org/ doesn't set a correct Content-Disposition for downloading a specific version of a module, so you will end up with filenames like v1.2.3.zip instead of foo-v1.2.3.zip which is somehow ugly. So I'd somehow need a way of providing a filename hint to CaPyCli.
As of today, CaPyCli has a kind-of-hidden feature for bom createcomponents --download - if there's an existing externalReference with comment source archive (local copy) (even if there's no local file available!), it will use that filename for the temporary download and especially for uploading the attachment for SW360. I think this dates back from the old proprietary CaPyCli SBOM format. However, this is currently not supported for the bom downloadsources command.
While I was happy to find that workaround, it seems quite confusing to provide a filename hint using a link to a non-existing local file.
As a possible alternative, there's siemens:filename from our Siemens property taxonomy. While it also has problems, e.g. it's defined per-component instead of per-externalReference, I think it's a somehow more natural way to provide filename hints.
So my suggestion would be to extend bom createcomponents --download as well as bom downloadsources to check for the siemens:filename property in the component, with this priority:
- If there's
siemens:filename, it will always win
- If there's a
Content-Disposition header, filename will be taken from there
- Otherwise, derive filename from last part of download URL.
Other options would be:
- Respect
siemens:filename, but with 2, 1, 3 priority (i.e. Content-Disposition wins over siemens:filename
- Ignore
siemens:filename and instead just extend bom downloadsources to respect "source archive (local copy)".
@tngraf, any thoughts?
I recently noticed that the https://proxy.golang.org/ doesn't set a correct
Content-Dispositionfor downloading a specific version of a module, so you will end up with filenames likev1.2.3.zipinstead offoo-v1.2.3.zipwhich is somehow ugly. So I'd somehow need a way of providing a filename hint to CaPyCli.As of today, CaPyCli has a kind-of-hidden feature for
bom createcomponents --download- if there's an existing externalReference with commentsource archive (local copy)(even if there's no local file available!), it will use that filename for the temporary download and especially for uploading the attachment for SW360. I think this dates back from the old proprietary CaPyCli SBOM format. However, this is currently not supported for thebom downloadsourcescommand.While I was happy to find that workaround, it seems quite confusing to provide a filename hint using a link to a non-existing local file.
As a possible alternative, there's
siemens:filenamefrom our Siemens property taxonomy. While it also has problems, e.g. it's defined per-component instead of per-externalReference, I think it's a somehow more natural way to provide filename hints.So my suggestion would be to extend
bom createcomponents --downloadas well asbom downloadsourcesto check for thesiemens:filenameproperty in the component, with this priority:siemens:filename, it will always winContent-Dispositionheader, filename will be taken from thereOther options would be:
siemens:filename, but with 2, 1, 3 priority (i.e.Content-Dispositionwins oversiemens:filenamesiemens:filenameand instead just extendbom downloadsourcesto respect "source archive (local copy)".@tngraf, any thoughts?