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

Make sure configured paths have no trailing slash #151

Merged
merged 1 commit into from
May 23, 2024
Merged

Conversation

glpatcern
Copy link
Member

No description provided.

@glpatcern glpatcern changed the title Make sure configured paths have no trailing slash, fixes #150 Make sure configured paths have no trailing slash May 23, 2024
@glpatcern glpatcern linked an issue May 23, 2024 that may be closed by this pull request
@glpatcern glpatcern merged commit 537294a into master May 23, 2024
2 checks passed
@glpatcern glpatcern deleted the urlfix branch May 23, 2024 10:47
Comment on lines +149 to +151
cls.wopiurl = cls.config.get('general', 'wopiurl').strip('/')
cls.homepath = cls.config.get('general', 'homepath', fallback='/home/username').strip('/')
cls.recoverypath = cls.config.get('io', 'recoverypath', fallback='/var/spool/wopirecovery').strip('/')
Copy link
Contributor

Choose a reason for hiding this comment

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

@glpatcern are you sure that strip does the right thing?

According to https://www.w3schools.com/python/ref_string_strip.asp, it removes trailing and leading slashes in our case. Which makes the path relative instead of absolute. I noticed it because I have a readonly filesystem in our Kubernetes setup and it tries to write somewhere it should not.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, sorry for that! Let's not over-engineer this, I will simply revert the change for the OS-level paths (where extra slashes are irrelevant anyway) and leave it for URLs (where the protocol prefix MUST be present)

glpatcern added a commit that referenced this pull request May 24, 2024
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.

Improper URL concatenation
3 participants