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

Decode URI encoded multibyte file names #221

Merged
merged 1 commit into from Nov 3, 2015

Conversation

Projects
None yet
4 participants
@suzukimilanpaak

I came across error saying a URI encoded file name is too long for a converted file name.

 ruby -rubygems -e 'require "jekyll-import";
quote>     JekyllImport::Importers::Blogger.run({
quote>       "source"                => "/Users/szkmp/Downloads/deletable/blog-10-10-2015.xml",
quote>       "no-blogger-info"       => false, # not to leave blogger-URL info (id and old URL) in the front matter
quote>       "replace-internal-link" => false, # replace internal links using the post_url liquid tag.
quote>     })'
/Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jekyll-import-0.8.0/lib/jekyll-import/importers/blogger.rb:187:in `initialize': File name too long @ rb_sysopen - _drafts/2013-01-23-%E3%83%87%E3%83%99%E3%83%AD%E3%83%83%E3%83%91%E3%81%8C%E3%83%87%E3%82%B6%E3%82%A4%E3%83%B3%E3%82%92%E3%81%99%E3%82%8B%E3%81%A8%E3%81%8D%E3%81%AB%E4%BE%BF%E5%88%A9%E3%81%9D%E3%81%86%E3%81%AA%E3%82%A6%E3%82%A7%E3%83%96%E3%82%B5%E3%82%A4%E3%83%88.html (Errno::ENAMETOOLONG)
    from /Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jekyll-import-0.8.0/lib/jekyll-import/importers/blogger.rb:187:in `open'
    from /Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jekyll-import-0.8.0/lib/jekyll-import/importers/blogger.rb:187:in `tag_end'
    from /Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rexml/parsers/streamparser.rb:28:in `parse'
    from /Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jekyll-import-0.8.0/lib/jekyll-import/importers/blogger.rb:46:in `block in process'
    from /Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jekyll-import-0.8.0/lib/jekyll-import/importers/blogger.rb:44:in `open'
    from /Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jekyll-import-0.8.0/lib/jekyll-import/importers/blogger.rb:44:in `process'
    from /Users/szkmp/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/jekyll-import-0.8.0/lib/jekyll-import/importer.rb:23:in `run'
    from -e:2:in `<main>'

This is a fix for the error. Please review

Show outdated Hide outdated lib/jekyll-import/importers/blogger.rb
@@ -184,6 +186,9 @@ def tag_end(tag)
FileUtils.mkdir_p(target_dir)
file_name = URI::decode("#{post_data[:filename]}.html")
File.open(File.join(target_dir, file_name), 'w') do |f|
File.open(File.join(target_dir, "#{post_data[:filename]}.html"), 'w') do |f|

This comment has been minimized.

@parkr

parkr Oct 11, 2015

Member

I believe you meant to replace this line.

@parkr

parkr Oct 11, 2015

Member

I believe you meant to replace this line.

This comment has been minimized.

@suzukimilanpaak

suzukimilanpaak Oct 13, 2015

opps, sorry it was a rough pull request. I fixed this

@suzukimilanpaak

suzukimilanpaak Oct 13, 2015

opps, sorry it was a rough pull request. I fixed this

Show outdated Hide outdated lib/jekyll-import/importers/blogger.rb
@@ -1,3 +1,5 @@
require 'open-uri'

This comment has been minimized.

@parkr

parkr Oct 11, 2015

Member

this needs to be put in a method called self.require_deps. It already exists

@parkr

parkr Oct 11, 2015

Member

this needs to be put in a method called self.require_deps. It already exists

@suzukimilanpaak

This comment has been minimized.

Show comment
Hide comment
@suzukimilanpaak

suzukimilanpaak Oct 13, 2015

fixed code and squashed

fixed code and squashed

parkr added a commit that referenced this pull request Nov 3, 2015

@parkr parkr merged commit 5368dcb into jekyll:master Nov 3, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

parkr added a commit that referenced this pull request Nov 3, 2015

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.