Skip to content
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

Fix encoding discrepancy in excluded Windows paths #76

Merged

Conversation

ashmaroli
Copy link
Member

@ashmaroli ashmaroli commented Oct 10, 2018

Summary

When a site is in a directory containing characters with accents and similar entities (e.g., testé-çasésûr),
the paths were encoded differently which were seen as a separate directory in the site.

Context

def listen_ignore_paths(options)
source = Pathname.new(options["source"]).expand_path
paths = to_exclude(options)
paths.map do |p|
absolute_path = Pathname.new(p).expand_path
next unless absolute_path.exist?
begin
relative_path = absolute_path.relative_path_from(source).to_s
unless relative_path.start_with?("../")

If I were to have a custom destination set to "public", then the absolute_path in the code above gets created with encoding Encoding:UTF-8 while the options["source"] encoding was in
Encoding:Windows-1252.
This resulted in a "relative_path" (via Pathname) starting with ../ which caused that path to not be included as an ignored_path

#<Pathname:D:/testAc-A§asAcsA»r/public>
#<Pathname:../testAc-A§asAcsA»r/public>

or when stringified:

D:/testAc-A§asAcsA»r/public
../testAc-A§asAcsA»r/public

Steps to reproduce issue (Windows only)

  • Create a site with accents in the path: jekyll new testé-çasésûr
  • Add a custom destination configuration (regular string)
    destination: public
  • Watch the site: bundle exec jekyll b --watch or bundle exec jekyll s
  • Make a change in any file..

/cc @jekyll/windows

Thanks

To @DirtyF for providing a test repository that led to the discovery of this bug

@ashmaroli ashmaroli requested review from a team October 10, 2018 12:18
@XhmikosR
Copy link

Shouldn't there be a test case for this?

@XhmikosR
Copy link

Oh, wait, there is. Then we should have AppVeyor set up so that this doesn't happen again.

@ashmaroli
Copy link
Member Author

@XhmikosR Do you want to add the appveyor.yml..? AppVeyor has been enabled on this repo..

@XhmikosR
Copy link

I could give it a go later, but my guess is you'd handle this faster than me :P

@DirtyF
Copy link
Member

DirtyF commented Nov 10, 2018

@jekyllbot: merge +fix

@jekyllbot jekyllbot merged commit 0cfb214 into jekyll:master Nov 10, 2018
@jekyllbot jekyllbot added the bug label Nov 10, 2018
jekyllbot added a commit that referenced this pull request Nov 10, 2018
@ashmaroli
Copy link
Member Author

@DirtyF Before this gets shipped, we need to ensure that this does not lead to any regressions in the encoding issues patched in the current public release..

@jekyll jekyll locked and limited conversation to collaborators Nov 10, 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.

4 participants