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 symbolic link handling in pelican-themes -s/-c #3392

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frederik-elwert
Copy link

Pull Request Checklist

  • Ensured tests pass and (if applicable) updated functional test output
  • Conformed to code style guidelines by running appropriate linting tools
  • Added tests for changed code
  • Updated documentation for changed code

Description

Symlinks with relative paths were not handled properly by pelican-themes.

Example:

The pelican theme to be installed is in a sibling directory to the project directory. Running

pelican-themes -s ../my-theme

creates a symlink ../my-theme in pelican’s theme folder. This link is broken, since the relative path in the symlink will now be resolved from pelican’s theme folder.

When running pelican-themes -c from the project folder, it will not detect the broken symlink, since the relative path will actually resolve from the current directory (just not from pelican’s theme folder).

This pull request fixes this by running os.path.realpath on the passed path both when creating symlinks and when checking symlinks. This will make sure that always the absolute paths are linked/checked.

@justinmayer
Copy link
Member

@frederik-elwert: Thank you for the submission!

Any thoughts from @getpelican/reviewers regarding this pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants