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

HTTP API - Validate artifact file extension #533

Open
gowravshekar opened this issue Jan 8, 2019 · 3 comments
Open

HTTP API - Validate artifact file extension #533

gowravshekar opened this issue Jan 8, 2019 · 3 comments

Comments

@gowravshekar
Copy link

Getting the below error if the file mentioned in the path paramter doesn't have any extension.

class akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://mist/user/$b#-1139334380]] after [5000 ms]. Sender[null] sent message of type "io.hydrosphere.mist.core.CommonData$GetFunctionInfo".

Appending .jar to file and adjusting the same in path works.

@gowravshekar gowravshekar changed the title Error in HTTP API Post /v2/api/functions. Error in HTTP API: POST /v2/api/functions. Jan 8, 2019
@dos65
Copy link
Contributor

dos65 commented Jan 9, 2019

It's required to provide correct file extension because Mist supports .py and .egg files as well as jars. So it's isn't actually a bug, it's a missing validation rule on artifact uploading.
It would be nice to respond with correct error explanation.

@dos65 dos65 changed the title Error in HTTP API: POST /v2/api/functions. HTTP API - Validate artifact file extetsion Jan 9, 2019
@dos65 dos65 changed the title HTTP API - Validate artifact file extetsion HTTP API - Validate artifact file extension Jan 9, 2019
@gowravshekar
Copy link
Author

Instead of forcing the end user for extension; How about appending the extension based on the mime-type of the artifact when the extension is missing.

  • application/java-archive for jar.
  • application/zip for egg.
  • text/plain for py

@dos65
Copy link
Contributor

dos65 commented Jan 9, 2019

Honestly, it's hard to imagine a situation when it would be useful. Usually, these types of files always have a correct file extension. Also, data that describes function has a path field that relies on the file extension too. Changing this thing will break backward compatibility.

Anyway, to upload an artifact you need to explicitly set a filename property and it doesn't have to be the same as in the original file. So you could easily add .jar extension on this step and it will not affect the other part of your workflow.

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

No branches or pull requests

2 participants