url: filterURLForDisplay
only considers basic image extensions
#53154
Labels
[Package] Url
/packages/url
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Related to #27530
What problem does this address?
The
filterURLForDisplay()
function in theurl
package properly processes the given URL string and generates a string for display. This function accomplishes two main things:www
subdomainmaxLength
is given and the URL is a media filename, return the filename containing an ellipsisExamples of various conversions can be seen in this unit test.
However, only basic image extensions are considered when rounding strings.
gutenberg/packages/url/src/filter-url-for-display.js
Line 24 in aa3bd6b
As a result, URLs in popovers may overflow in
LinkControl
components that use this function, for example.Expected
URL with jpg image
Unexpected
URL with webp image
URL with mp4 video
What is your proposed solution?
I would suggest either of the following approaches:
mime_types
filter may be helpful)Step-by-step reproduction instructions
N/A
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: