Comments (5)
Can't we just replace %E2%80%A6
with that character after using URL
?
from truncate-url.
@sindresorhus What if the original URL already has this included?
from truncate-url.
Hm. We could use decodeURIComponent
on the final URL. It's going to be used for presentational purposes, so it doesn't have to be a valid URL. Although, I haven't fully thought through all the consequences of this.
from truncate-url.
In my use case I want to use the truncated URL for a linkchecker dashboard and that wouldn't work well with the decodeURIComponent
solution.
Let's say the original (broken) URL is https://www.example.com/some/dir/file%20with%20spaces.html
and the truncated URL that the dashboard shows is then https://www.example.com/…/file with spaces.html
. Now if you CTRLF in your code for file with spaces.html
you can't find it.
Maybe we could insert an unique string and replace it with …
afterwards?
from truncate-url.
Maybe we could insert an unique string and replace it with … afterwards?
Yeah, that could work.
from truncate-url.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from truncate-url.