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 handling of relative references #1557

Merged
merged 1 commit into from Apr 27, 2021
Merged

Conversation

johanra
Copy link

@johanra johanra commented Apr 26, 2021

This PR includes a fix & testcase for this [issue] (#1459)

@gracekarina
Copy link
Contributor

thanks @johanra

@olesiathoms-wk
Copy link

@gracekarina Do you know when this fix will be released?

@slimane-deb
Copy link

@johanra Looking forward to it. Thumbs up

Comment on lines +282 to +284
if(ref.startsWith("./")) {
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry for asking a long time after this was merged, but wouldn't this make it a relative ref instead of an absolute one? Wouldn't it need to start with a <scheme>: to be considered absolute?

Copy link
Author

Choose a reason for hiding this comment

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

You are right this is not correct.
My intention was to have the isAbsoluteRef method match anything that is not relative.
The code should then look like this:
protected boolean isAbsoluteRef(String ref) { return !ref.startsWith("."); ​}

protected String computeRelativeRef(String ref, String prefix) {
if(ref.startsWith("./")) {
​return ref;
​}
int iIdxOfSlash = prefix.lastIndexOf('/');
if(iIdxOfSlash != -1) {
return prefix.substring(0, iIdxOfSlash+1) + ref;
}
return prefix + ref;
​}

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.

None yet

5 participants