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

Partinfo field "partFileName" is a Maybe, but is never Nothing? #159

Open
ghost opened this issue Oct 26, 2012 · 10 comments
Open

Partinfo field "partFileName" is a Maybe, but is never Nothing? #159

ghost opened this issue Oct 26, 2012 · 10 comments

Comments

@ghost
Copy link

ghost commented Oct 26, 2012

When you submit a form that contains a file input element, and have not selected a file, you get a PartInfo containing: partFileName = Just "" instead of Nothing.

@dbp
Copy link

dbp commented Jul 29, 2014

I just ran into this, and it seems very wrong... This issue has obviously been open for a while - is there a specific design reason for this, or is it a bug (that should be fixed)?

@gregorycollins
Copy link
Member

It's probably a bug -- please send a minimal server exhibiting the problem along with instructions for reproduction.

dbp pushed a commit to dbp/snap-upload-blank-example that referenced this issue Jul 29, 2014
@dbp
Copy link

dbp commented Jul 29, 2014

@gregorycollins Here's a repository containing a server that exhibits the problem:

https://github.com/dbp/snap-upload-blank-example

To reproduce, build and run the server, then visit the index, and hit submit without setting a file. It will print, to the console:

PartInfo {partFieldName = "f", partFileName = Just "", partContentType = "application/octet-stream"}

Which I believe should instead be:

PartInfo {partFieldName = "f", partFileName = Nothing, partContentType = "application/octet-stream"}

dbp pushed a commit to positiondev/digestive-functors that referenced this issue Jul 29, 2014
dbp pushed a commit to positiondev/digestive-functors that referenced this issue Oct 18, 2014
dbp pushed a commit to positiondev/digestive-functors that referenced this issue Oct 21, 2014
dbp pushed a commit to positiondev/digestive-functors that referenced this issue Jul 21, 2015
@emhoracek
Copy link

I think this is fixed in Digestive Functors since https://github.com/jaspervdj/digestive-functors/pull/125/files (0.8.1.0), in that they changed the type from a Maybe to a list in order to support multiple file upload.

@mightybyte
Copy link
Member

@emhoracek Sorry I missed your comment until just now. Are you saying that the issue is gone and we should close this ticket, or just that digestive-functors worked around it and it's less important?

@emhoracek
Copy link

@mightybyte I found this issue while debugging a problem with Fn and just wanted to share what I found for any other googlers. If Snap is using the latest digestive functors it should be fixed, but I haven't actually tried it.

@mightybyte
Copy link
Member

@emhoracek Ok, thanks. It sounds like this might still be considered a bug in snap-core or potentially snap-server, so I'll leave this open for now.

@k0001
Copy link

k0001 commented Nov 27, 2018

I just encountered this issue.

This is what Firefox sends:

-----------------------------8290905687149505892030108654
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream

I don't think the difference between Nothing and Just "" is relevant here: They both signify a lack of filename. I think having partFileName :: ByteString rather than partFileName :: Maybe ByteString would be better.

@gregorycollins
Copy link
Member

Should we treat filename="" as Nothing instead of Just ""? It's a major version bump but I agree that current behavior violates principle of least surprise

@gregorycollins
Copy link
Member

...and P.S. I'd prefer this to changing the type, since a correct user program will probably not be broken by that change.

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

5 participants