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 pl.path can't resolve the path started with ~ #94

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

AllenFang
Copy link
Contributor

@AllenFang AllenFang commented Nov 20, 2023

Base on lunarmodules/luafilesystem#172, seem pl.isfile and pl.isdif will return the wrong result if the path start with "~"

currently I can confirm there's a bug when load cred file:

local credential = require("resty.aws.config").load_credentials_file("~/.aws/credentials", "xxxprofile")

Above I got nil caused by here, however, I am sure my credentials file exist and format is definitely correct. So I raised the lunarmodules/luafilesystem#172 issue. Not sure how and when they fix it but we can safely fix this issue by an absolute path.

@CLAassistant
Copy link

CLAassistant commented Nov 20, 2023

CLA assistant check
All committers have signed the CLA.

@Tieske
Copy link
Member

Tieske commented Nov 21, 2023

This is not a task for luafilesystem. Penlight can handle this, see https://lunarmodules.github.io/Penlight/libraries/pl.path.html#expanduser

@AllenFang
Copy link
Contributor Author

AllenFang commented Nov 21, 2023

thanks @Tieske

what's the solution you will suggest to?

  1. use expanduser in every places that use the penlight isfile function (ex: here)
  2. only use expanduser for the default config/credential file path value (ex: here)
    • a probably minor drawback is if user want to customize the path, they have to either give absolute path or wrap up the path by expanduser.

my opinion is first one 🙇

@Tieske
Copy link
Member

Tieske commented Nov 21, 2023

first option seems fine to me

@AllenFang AllenFang force-pushed the chore/fix-plpath-issue branch 5 times, most recently from 604174c to a96d087 Compare December 3, 2023 07:46
@AllenFang
Copy link
Contributor Author

@Tieske sorry for late reply, please take a look. thank you 🙇

Copy link
Member

@Tieske Tieske left a comment

Choose a reason for hiding this comment

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

lgtm

@windmgc
Copy link
Member

windmgc commented Dec 25, 2023

@AllenFang Could you sign the CLA and add a changelog entry in the README?

@AllenFang
Copy link
Contributor Author

okay, will do it soon

@AllenFang
Copy link
Contributor Author

hi @windmgc @Tieske just sign the CLA. thanks

@tzssangglass
Copy link
Member

ping @windmgc

@windmgc windmgc merged commit 893ed35 into Kong:main Jan 15, 2024
6 checks passed
windmgc added a commit that referenced this pull request Jan 15, 2024
Tieske pushed a commit that referenced this pull request Jan 16, 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.

5 participants