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
Text parameters go missing depending on uploaded file's size? #4776
Comments
@VirtualWolf Thanks for posting, we'll take a look as soon as possible. In the meantime, if you haven’t already, please carefully read the issue contribution guidelines and double-check for any missing information above. In particular, please ensure that this issue is about a stability or performance bug with a documented feature; and make sure you’ve included detailed instructions on how to reproduce the bug from a clean install. Finally, don’t forget to include the version of Node.js you tested with, as well as your version of Sails or Waterline, and of any relevant standalone adapters/generators/hooks. Thank you! |
Ok, so I see the same behaviour happens even just by editing skipper's own So I guess the next question is, what's the best solution here for when it's not possible to have the form order changed? I assume I'm not the only one who's run into this sort of problem. :) |
So after many hours of mostly fruitless Googling, I found out how to change the body parser that Sails uses just for a specific route. I'm not familiar with Express in general, so all of the "Just add it as middleware in My solution was to uncomment the
And so then my controller looked like this:
Then everything works as expected! And skipper is still used for everything else except this one specific function. |
I've written a little custom media upload tool for the Twitter client Tweetbot (see their specification here for the details of what Tweetbot sends) that takes a file attached to a tweet, saves it to disk and returns a URL for it, and saves the tweet text to Postgres. The saving and return of the URL for the filename works fine, but I've discovered that the text parameters (the
source
andmessage
fields from the link above) are going missing when the file uploaded is over a certain size (and this size seems to vary somewhat, too).I'm able to replicate it easily and have chucked it into a repository. I've also added a couple of tests demonstrating the behaviour, using the same form order that Tweetbot uses.
If
DEBUG=skipper
is turned on, I see this for the working, <100KB file:Note the
Read a chunk of textparam
andDone reading text param
lines.On the >300KB file, neither of those lines appear:
And the console.log statement shows "undefined" for
message
.I realise that Skipper's docs say that the file should be last on any given form, but is what I'm seeing expected behaviour? Why does it differ depending on uploaded filesize?
The only other references I can find to this issue are this Stack Overflow question which has no answer, and #60 right here.
Sails.js is at 0.12.11, and Skipper appears to be the 0.6.5 version that comes with it. I upgraded Sails' Skipper dependency to 0.7.3 but it didn't make a difference. Node.js itself is 6.9.1 under macOS 10.12.1.
Any help or insight would be much appreciated!
The text was updated successfully, but these errors were encountered: