To encode or not encode - best practices for "uncommon" uri characters, including whitespaces (%20)?
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 30/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- networking
Piste de recherche
Reproduisez les exemples avec rfc3986.builder.URIBuilder.from_uri, extend_path et finalize, en comparant les espaces blancs de l’URI initiale avec ceux transmis à extend_path. Consultez la section de RFC 3986 liée dans l’issue et déterminez si les deux chemins de construction devraient produire le même résultat encodé en pourcentage ; le travail est considéré comme terminé lorsque le comportement attendu est décidé et couvert par un test de régression.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Dear all,
I am currently struggeling with a whitespace problem which I guess should not be that complicated - so I probably missing something here.
MWE:
import rfc3986.builder
rfc3986.builder.URIBuilder.from_uri("scheme:").extend_path("path 1").extend_path("path2").geturl()
# outout: 'scheme:/path 1/path2'
rfc3986.builder.URIBuilder.from_uri("scheme:").extend_path("path 1/path2").geturl()
# outout: 'scheme:/path 1/path2'
rfc3986.builder.URIBuilder.from_uri("scheme:path 1").extend_path("path2").geturl()
# outout: 'scheme:/path%201/path2'
therefore: If i am having a whitespace in the from_uri-part, it gets escaped by %20, whereby having the whitespace as part of the parameter to extend_path, it gets used as is.
From the broader scope, I am storing URIs in a database which get constructed on one component "from scratch" (containing whitespaces ...), whereas they are passed in a url-encoded - conformant manner in another component.
I already figured out that there is an equivalence when passing maybe-url-encoded strings to from_uri:
from_uri_a=rfc3986.builder.URIBuilder.from_uri("scheme:/path 1/path2").finalize()
from_uri_b=rfc3986.builder.URIBuilder.from_uri("scheme:/path%201/path2").finalize()
from_uri_a == from_uri_b
# is True
My main goal is to store the URIs in a future-proof way in my database and from the requirements I am having it does not really make a big difference whether or not I am storing the URLs encoded or not - but from the broader scope I am unsure whether the current implementation is desired or not (aka. a bug or a feature).
From the rfc, sec. 2.4, I guess that an encoding should take place in the extend_path method:
Under normal circumstances, the only time when octets within a URI
are percent-encoded is during the process of producing the URI from
its component parts. This is when an implementation determines which
of the reserved characters are to be used as subcomponent delimiters
and which can be safely used as data. Once produced, a URI is always
in its percent-encoded form.
Any thoughts on this?
- Langage dominant
- Python
- Étoiles
- 189
- Forks
- 43
- Merge moyen
- 12 h 14 min
- PR mergées (30 j)
- 2
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-hyper/rfc3986
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
python-hyper/rfc3986#164 ·
-
ParseResultBytes.unsplit() raises AttributeError for a reference without an authorityPeut-être pris @mayuriphad l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
python-hyper/rfc3986#163 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
python-hyper/rfc3986#138 · 1 commentaire ·
-
sdist is missing `tox.ini`Peut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 55/100
python-hyper/rfc3986#129 ·
-
wrong parseOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 38/100
python-hyper/rfc3986#128 ·
Toutes les issues de python-hyper/rfc3986
Issues similaires
-
[Resource] agent-claimcheckOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
yzhao062/awesome-auditable-ai#45 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
NVIDIA/flare-local-inference#90 ·
Les mainteneurs répondent en général sous 1 jour
-
area/streaming comp/gateway P2 platform/telegram type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
NousResearch/hermes-agent#144897 ·
Les mainteneurs répondent en général sous 1 jour
-
request-theme
Difficulté 1/5 Moins d'une heure Accessibilité débutants 66/100
LizardByte/ThemerrDB#9575 ·
Les mainteneurs répondent en général sous 1 jour