You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
When file.rewind is not there, then some files will end up being uploaded as blank files and some will not.
When file.rewindis there, then the file always gets uploaded correctly.
First explanation that comes to mind is something to do with file size (although our samples of working and non-working instances don't really suggest that that's the reason, but I haven't explored this thoroughly). Maybe CSV doesn't flush until a certain size of file has been processed. This didn't pan out because:
does rewind result in a flush first? I'm guessing not
i experimented with a very simple script (below) and things behave as expected. rewind is necessary to read from the file (which makes sense — only the block form of CSV might be expected to flush, close, and/or rewind a file)
csv seems to always flush on each input of a new row (although discussion found while googling seems to suggest otherwise — maybe the block form of CSV keeps a buffer?)
Which is all to say that it seems like it's paperclip which is the one that sometimes rewinds, sometimes does not.
Searching the codebase for this behavior led me nowhere.
Can someone point me in the right direction on where the relevant code in paperclip might be?
And/or does someone doubt that the non-rewind version ever worked? I'm quite certain that it did. But if this seems preposterous to someone, then I'll set up an environment with my old code and check again.
rails 5.1.6.1
ruby 2.5.3
paperclip 6.0.0
I have code like this:
When
file.rewind
is not there, then some files will end up being uploaded as blank files and some will not.When
file.rewind
is there, then the file always gets uploaded correctly.First explanation that comes to mind is something to do with file size (although our samples of working and non-working instances don't really suggest that that's the reason, but I haven't explored this thoroughly). Maybe CSV doesn't flush until a certain size of file has been processed. This didn't pan out because:
rewind
result in aflush
first? I'm guessing notWhich is all to say that it seems like it's paperclip which is the one that sometimes rewinds, sometimes does not.
Searching the codebase for this behavior led me nowhere.
Can someone point me in the right direction on where the relevant code in paperclip might be?
And/or does someone doubt that the non-rewind version ever worked? I'm quite certain that it did. But if this seems preposterous to someone, then I'll set up an environment with my old code and check again.
Thanks! Let me know any questions!
The text was updated successfully, but these errors were encountered: