GithubHelp home page GithubHelp logo

Comments (5)

sindresorhus avatar sindresorhus commented on July 28, 2024

Can't we just replace %E2%80%A6 with that character after using URL?

from truncate-url.

Zauberbutter avatar Zauberbutter commented on July 28, 2024

@sindresorhus What if the original URL already has this included?

from truncate-url.

sindresorhus avatar sindresorhus commented on July 28, 2024

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.

Zauberbutter avatar Zauberbutter commented on July 28, 2024

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.

sindresorhus avatar sindresorhus commented on July 28, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.