-
Notifications
You must be signed in to change notification settings - Fork 81
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
Retrieve link name from link when using link asset #401
Conversation
if (!label) { | ||
const parsedUrl = new URL(_url); | ||
const file = pathlib.basename(parsedUrl.pathname); | ||
_label = file ? file : 'Unknown asset'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the fallback here. What about using parsedUrl.hostname
?
Also can any of these throw an exception that we should handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean replacing 'Unknown asset' by parsedUrl.hostname
?
Actually I am thinking any better handling here too since the link name must be unique within the release.
So when user have urls like below will cause exception during publish
https://server1.com/1.txt
https://server2.com/1.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could include the index from .map
, e.g.:
_label = file ? file : `${parsedUrl.hostname}_${index}`;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this @awcjack! Left some comments.
@awcjack Are you planning to continue here? If not just speak and I can finish it! |
Co-authored-by: Florian Greinacher <[email protected]>
Co-authored-by: Florian Greinacher <[email protected]>
Quite busy last week and forget the pull request 🙈 |
This PR has been stale for over a year now, so I'm closing it. Feel free to recreate if needed :) |
link name is required for link asset following documentation
If label property is not provided, try to retrieve the link name from url
Close #393