SquareMill / staticizer

A tool to create a static version of a website for hosting on S3.
MIT License
29 stars 14 forks source link

(Errno::ENAMETOOLONG) #6

Open Qambar opened 7 years ago

Qambar commented 7 years ago

Hi, i am getting this long name error (Errno::ENAMETOOLONG) when i run the following command

staticizer http://qambarraza.com -output-dir=qambarraza.com

The site name is qambarraza.com which i have replaced it in the error message but you can figure that out from the command above:

I, [2017-07-05T22:21:27.847617 #33823]  INFO -- : Saving utput-dir=<sitename>/wp-includes,_js,_jquery,_jquery-migrate.min.js,qver==1.4.1+wp-content,_plugins,_add-to-any,_addtoany.min.js,qver==1.0+wp-content,_themes,_zacklive,_assets,_js,_bootstrap,_bootstrap.js,qver==4.7.5+wp-content,_themes,_zacklive,_assets,_js,_bootstrap-wp.js,qver==4.7.5.pagespeed.jc.oXsCQ1rSYH.js
/Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:154:in `initialize': File name too long - utput-dir=<sitename>/wp-includes,_js,_jquery,_jquery-migrate.min.js,qver==1.4.1+wp-content,_plugins,_add-to-any,_addtoany.min.js,qver==1.0+wp-content,_themes,_zacklive,_assets,_js,_bootstrap,_bootstrap.js,qver==4.7.5+wp-content,_themes,_zacklive,_assets,_js,_bootstrap-wp.js,qver==4.7.5.pagespeed.jc.oXsCQ1rSYH.js (Errno::ENAMETOOLONG)
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:154:in `open'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:154:in `save_page_to_disk'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:110:in `save_page'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:194:in `process_success'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:233:in `block in process_url'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1419:in `block (2 levels) in transport_request'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http/response.rb:162:in `reading_body'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1418:in `block in transport_request'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1409:in `catch'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1409:in `transport_request'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1382:in `request'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1375:in `block in request'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:852:in `start'
  from /Users/<username>/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1373:in `request'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:230:in `process_url'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/lib/staticizer/crawler.rb:55:in `crawl'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/gems/staticizer-0.0.7/bin/staticizer:11:in `<top (required)>'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/bin/staticizer:23:in `load'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/bin/staticizer:23:in `<main>'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/bin/ruby_executable_hooks:15:in `eval'
  from /Users/<username>/.rvm/gems/ruby-2.0.0-p648/bin/ruby_executable_hooks:15:in `<main>'
conorh commented 7 years ago

There is a long URL on that site which, when saved to disk, creates a filename that is too long for your file system. Simplest would be to skip those URLs (which would break something in the resulting HTML - which might be ok?), or maybe you could re-write the long URLs, but that would be more complicated as you would need to re-write the references in the referring HTML that is written out too.

This is less likely to be an issue when saving directly to s3 because the max length for a key there is usually longer than your filesystem.