Skip to content

fix pl.path can't resolve the path started with ~ - #94

Merged
windmgc merged 2 commits into
Kong:mainfrom
AllenFang:chore/fix-plpath-issue
Jan 15, 2024
Merged

fix pl.path can't resolve the path started with ~#94
windmgc merged 2 commits into
Kong:mainfrom
AllenFang:chore/fix-plpath-issue

Conversation

@AllenFang

@AllenFang AllenFang commented Nov 20, 2023

Copy link
Copy Markdown
Contributor

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

CLAassistant commented Nov 20, 2023

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Tieske

Tieske commented Nov 21, 2023

Copy link
Copy Markdown
Contributor

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

@AllenFang

AllenFang commented Nov 21, 2023

Copy link
Copy Markdown
Contributor Author

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

Tieske commented Nov 21, 2023

Copy link
Copy Markdown
Contributor

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
AllenFang force-pushed the chore/fix-plpath-issue branch from a96d087 to 122be0b Compare December 3, 2023 07:49
@AllenFang

Copy link
Copy Markdown
Contributor Author

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

@Tieske Tieske left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@windmgc

windmgc commented Dec 25, 2023

Copy link
Copy Markdown
Member

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

@AllenFang

Copy link
Copy Markdown
Contributor Author

okay, will do it soon

@AllenFang

Copy link
Copy Markdown
Contributor Author

hi @windmgc @Tieske just sign the CLA. thanks

@tzssangglass

Copy link
Copy Markdown
Member

ping @windmgc

@windmgc
windmgc merged commit 893ed35 into Kong:main Jan 15, 2024
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