Coder Social home page Coder Social logo

Comments (12)

Be-ing avatar Be-ing commented on August 29, 2024 1

I disagree. It would be better to prevent passing invalid URLs by using a URL type as the input.

from ashpd.

bilelmoussaoui avatar bilelmoussaoui commented on August 29, 2024 1

The latest zvariant release implement the necessary types for us to make use of url::Url type.

from ashpd.

bilelmoussaoui avatar bilelmoussaoui commented on August 29, 2024

I don't think it is useful to depend on an external crate for this. But yes, having some very basic in-tree URI type that can be used instead of plain String would be nice. Do you want to submit a patch for that? There are not that many usages that I can think of.

Only Account, Screenshot & FileChooser returns a URI.

from ashpd.

Be-ing avatar Be-ing commented on August 29, 2024

This would be a breaking API change. Would you want to make a new major release just for this? Or maybe wait and do this together with other breaking changes?

from ashpd.

bilelmoussaoui avatar bilelmoussaoui commented on August 29, 2024

This would be a breaking API change. Would you want to make a new major release just for this? Or maybe wait and do this together with other breaking changes?

I am planning to make a new major release yes so it is fine to do breaking changes

from ashpd.

A6GibKm avatar A6GibKm commented on August 29, 2024

I am not sure this is the best idea. The user can always do

let uri = url::Url::parse("something")?;
some_ashd_portal(uri.into()).await?;

when verification is needed. But maybe forcing the parse on our side is a good idea?

from ashpd.

Be-ing avatar Be-ing commented on August 29, 2024

For my use case I am more concerned with properly handling URIs read from ashpd. I was making mistaken assumptions about the returned data which the compiler let me do because it was a String. If its type conveyed it was a URI, that couldn't be ignored.

from ashpd.

bilelmoussaoui avatar bilelmoussaoui commented on August 29, 2024

There is no URI inputs, only outputs btw. So we could have just a pub struct URI(String) & return that.

from ashpd.

A6GibKm avatar A6GibKm commented on August 29, 2024

Doesn't the uri portal require a url input

from ashpd.

bilelmoussaoui avatar bilelmoussaoui commented on August 29, 2024

Doesn't the uri portal require a url input

Hmm yeah indeed.

from ashpd.

bilelmoussaoui avatar bilelmoussaoui commented on August 29, 2024

there is also the wallpaper portal that takes a uri

from ashpd.

A6GibKm avatar A6GibKm commented on August 29, 2024

I think the best thing to do is to accept arbitrary strings, but return early (error) if, say, url::Url::parse(input) fails.

from ashpd.

Related Issues (20)

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.