Topic: I can't upload swf, help! D:

Posted under General

When I try to upload a swf file ii get some weird screen with a bunch of text. The text is shown below.

ArgumentError in PostController#create

/home/e621/e621-production/current/vendor/image_size.rb:258:in Integer': invalid value for Integer: "0b" RAILS_ROOT: /home/e621/e621-production/current Application Trace | Framework Trace | Full Trace /home/e621/e621-production/current/vendor/image_size.rb:77:in initialize'
/home/e621/e621-production/current/vendor/image_size.rb:258:in measure_SWF' (eval):1:in initialize'
/home/e621/e621-production/current/app/models/post_methods/file_methods.rb:173:in eval' /home/e621/e621-production/current/app/models/post_methods/file_methods.rb:173:in new'
/home/e621/e621-production/current/app/models/post_methods/file_methods.rb:173:in determine_content_type' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:178:in send'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:178:in evaluate_method' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:166:in call'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:93:in run' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:92:in each'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:92:in send' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:92:in run'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:276:in run_callbacks' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/callbacks.rb:344:in callback'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/callbacks.rb:312:in valid?' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/validations.rb:1088:in save_without_dirty'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/dirty.rb:79:in save_without_transactions' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:229:in send'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:229:in with_transaction_returning_status' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in transaction'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:182:in transaction' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:228:in with_transaction_returning_status'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:196:in save' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:208:in rollback_active_record_state!'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:196:in save' /home/e621/e621-production/current/app/controllers/post_controller.rb:108:in create'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:1333:in send' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:1333:in perform_action_without_filters'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/filters.rb:617:in call_filters' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/filters.rb:610:in perform_action_without_benchmark'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/core_ext/benchmark.rb:17:in ms'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/core_ext/benchmark.rb:17:in ms' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/rescue.rb:160:in perform_action_without_flash' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/flash.rb:151:in perform_action'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:532:in send' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:532:in process_without_filters'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/filters.rb:606:in process' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:391:in process'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:386:in call' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/routing/route_set.rb:438:in call'

Request

Parameters:

{"post"=>{"description"=>"A text game I found on FA,
Forgive the lacking tags but I haven't explored too much in it. Maybe you guys could add as you play.",
"tags"=>"gay male female straight text text_game cum cum_in_ass dragon equine horse penis balls animated flash mouse tagme lizard reptile sex",
"parent_id"=>"",
"file"=>#<File:/tmp/RackMultipart20140604-5043-ytey8w-0>,
"source"=>"http://www.furaffinity.net/view/11917533/",
"rating"=>"Explicit"}}

Show session dump
Response

Headers:

{"Cache-Control"=>"no-cache",
"Content-Type"=>"",
"Set-Cookie"=>"blacklisted_tags=; path=/\nblacklist_avatars=true; path=/\nblacklist_users=false; path=/"}

How do I fix this?

Updated by spight

Odd worked for me the other day.
I would say try again, if it still doesn't work, wait a few hours, and try again.

Those sort of errors tend to be temporary.

Updated by anonymous

spight

Former Staff

Hey there,

This looks like an issue with the SWF you're trying to upload, actually, though I haven't been able to find your specific file.

I'm going to get technical here for posterity's sake, so feel free to skip to the TLDR

(I'm not sure exactly where the code came from, so I'm going to assume it was written by someone in the e6 staff, and as such cannot link you to a github repo)

I did get another example of a file failing in the same way, so I dug through the code a little bit. The issue arises when checking the SWF files header's to get the bit length.

The first three headers should be CWS, FWS, or ZWS. The C, F, or Z identify the compression type used in the file, Z for LZMA, C for zlib, and F for uncompressed. If the image is compressed, as per this piece of the header, the rest of the header is decompressed, which is where the problem seems to arise.

When the code tries to decompress the file, it bombs out and returns nil. Then when we try to convert the nil to an Integer, which would either convert to 0 (if you did nil.to_s(2)) or raise an exception (if you tried to do Integer('0b#{nil}').

If you want to take a stab at editing the file manually, you can open the file in any editor and change the first letter from "C" to "F". (Back it up first if this is the only copy of the SWF)

(For anyone curious, the SWF header specifics I'm referring to are the first field of page 27 here: http://www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf_file_format_spec_v10.pdf)

TL;DR - Based on another example , your flash file may be saying it's compressed when it's not.

If you want me to have a look into your file specifically, you can send it to [email protected] or PM me with another way.

Updated by anonymous

spight

Former Staff

Actually, all of my testing was with the file you tried to upload, but I didn't realize it. (One of my colleagues linked me to it directly, but I thought he was giving me another example). Editing the first character from C to F fixed the issue for me.

Let me see if I can upload the edited version on your behalf.

Updated by anonymous

spight

Former Staff

Actually, that SWF is just awkward. It's compressed, but the part we're trying to decompress isn't... I'm just going to fix this in our metadata plugin. Expect it two updates from now.

Updated by anonymous

  • 1