Skip to content

Blogger: replace special characters with hyphens in the post name#280

Merged
jekyllbot merged 3 commits intojekyll:masterfrom
soywiz:blogger-special-symbols-in-name-fix
Nov 6, 2017
Merged

Blogger: replace special characters with hyphens in the post name#280
jekyllbot merged 3 commits intojekyll:masterfrom
soywiz:blogger-special-symbols-in-name-fix

Conversation

@soywiz
Copy link
Contributor

@soywiz soywiz commented Oct 18, 2016

No description provided.

@soywiz
Copy link
Contributor Author

soywiz commented Oct 18, 2016

Tried (with bash-for-windows and plain windows), but failed miserably, into setting up the test environment. So no tests here. I could try on my macbook but no guarantees. Also I don't know ruby.
Another option:
I could try to add a test that just places a xml with the title with special characters (using other test as reference), and do not place any assert at all. But at least checks that there are no exceptions. If I remember fine, it throws an exception with a wrong file name. And let travis tell me if that was fine directly in the PR :P

filename = "%s-%s" %
[timestamp,
CGI.escape(name.downcase).tr('+','-')]
name.downcase.tr('+/\\:\'"<>{}?%*|.','-')]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might still need the CGI.escape here. I might also put this into its own method.

def sanitized_filename(timestamp, name)
  return timestamp if name.nil?

  "%s-%s" % [
    timestamp,
    CGI.escape(name.downcase.tr('+/\\:\'"<>{}?%*|.', '-'))
  ]
end

Then remove from if name.nil? to the first end, and replace it with filename = sanitized_filename(name, timestamp) 😄

@parkr
Copy link
Member

parkr commented Oct 18, 2016

Fixes #277.

@parkr
Copy link
Member

parkr commented Dec 17, 2016

@soywiz Do you still want to apply the changes that I asked for above?

@parkr parkr changed the title Blogger importer problem with special characters in title Fixes #277 Blogger: replace special characters with hyphens in the post name Nov 6, 2017
@parkr
Copy link
Member

parkr commented Nov 6, 2017

Thank you!

@jekyllbot: merge +bug

@jekyllbot jekyllbot merged commit 8512897 into jekyll:master Nov 6, 2017
jekyllbot added a commit that referenced this pull request Nov 6, 2017
@jekyll jekyll locked and limited conversation to collaborators Apr 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants