Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain original file name #22

Closed
Quirexx opened this issue Feb 8, 2021 · 2 comments · Fixed by #30
Closed

Retain original file name #22

Quirexx opened this issue Feb 8, 2021 · 2 comments · Fixed by #30
Assignees

Comments

@Quirexx
Copy link

Quirexx commented Feb 8, 2021

Description:
Is there a possibility to retain the filename after unstashing?

According to the Javadoc, the original file name is available in FileItem:
https://commons.apache.org/proper/commons-fileupload/apidocs/org/apache/commons/fileupload/FileItem.html#getName--

Current behaviour:
The name of the unstashed file is the name of the stashedFile parameter

Expected behaviour:
Have access to the original file name (either through actual filename or another mechanism).

@jglick
Copy link
Member

jglick commented Feb 8, 2021

The filename passed to an upload is unreliable and may even be missing in some invocation styles. Anyway, even assuming it were used, how would the receiving pipeline know which file to use from the stash? In general it would need to run a sh command with a wildcard (*) or similar.

I suppose an extra *_FILENAME environment variable could be defined with the original filename, when available, for use by scripts which were interested in this information. You would need to be rather defensive, though, as blindly referring to such a variable from your script could open your project to Shellshock-like attacks (depending on the state of the art in defenses against this sort of thing in Jenkins core).

@amartin755
Copy link

A possiblity to get the original file name would be great. I'm using jenkins for automated testing, where the user uploads a binary firmware file. After the test, the file will be archived and the file name is also part of test logs. All firmware-files contain version and build infos in their file name. So without having the original file name, important information will be lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants