Projet

Général

Profil

Bug #8889

get_variadic_url oublie la query string pour [site-url]?var=value

Ajouté par Thomas Noël il y a plus de 8 ans. Mis à jour il y a plus de 8 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
Début:
05 novembre 2015
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Un test qui fait planter :

diff --git a/tests/test_variadic_url.py b/tests/test_variadic_url.py
index 447bbfd..f8f4dd0 100644
--- a/tests/test_variadic_url.py
+++ b/tests/test_variadic_url.py
@@ -64,6 +64,10 @@ def test_url_server():
     assert get_variadic_url('[url]/foobar',
             {'url': 'http://www.example.net'}) == 'http://www.example.net/foobar'

+def test_url_server_qs_without_slash():
+    assert get_variadic_url('[url]?foo=bar',
+            {'url': 'http://www.example.net/'}) == 'http://www.example.net/?foo=bar'
+
 def test_url_server_more():
     assert get_variadic_url('[url]/foobar/json?toto',
             {'url': 'http://www.example.net'}) == 'http://www.example.net/foobar/json?toto'

donne :

E       assert 'http://www.example.net/' == 'http://www.example.net/?foo=bar'
E         - http://www.example.net/
E         + http://www.example.net/?foo=bar
E         ?                        ++++++++

J'en suis à regarder et à penser que ça se joue ici :

323                 if p2.path and not path:
324                     path, query = p2.path, p2.query

où on oublie de penser qu'il y a peut-être une query existante, qu'on oublie gentilment (foo=bar dans le test)


Fichiers

Révisions associées

Révision 143d4329 (diff)
Ajouté par Thomas Noël il y a plus de 8 ans

misc: don't lose query string in variadic URL (#8889)

Révision 6cf22249 (diff)
Ajouté par Frédéric Péters il y a plus de 8 ans

misc: extend variadic URL to support even more variations (#8889)

Historique

#1

Mis à jour par Thomas Noël il y a plus de 8 ans

  • Statut changé de Nouveau à En cours
  • Patch proposed changé de Non à Oui

Pas très joli mais à cette heure j'ai rien d'autre à proposer.

#3

Mis à jour par Thomas Noël il y a plus de 8 ans

et ça permet d'autres magies qui pourraient être imaginées, j'ajoute un test.

#4

Mis à jour par Thomas Noël il y a plus de 8 ans

posé vite sur https://demarches-alfortville.test.entrouvert.org/

(mais une autre correction sera possible)

#5

Mis à jour par Thomas Noël il y a plus de 8 ans

  • Sujet changé de get_variadic_url à get_variadic_url oublie la query string pour [site-url]?var=value
  • Assigné à mis à Thomas Noël
#6

Mis à jour par Frédéric Péters il y a plus de 8 ans

Je voudrais bien voir les tests doublés (ça peut être simplement en dupliquant la ligne asset), une fois avec 'url': 'http://www.example.net/' et une fois avec 'url': 'http://www.example.net'.

#7

Mis à jour par Frédéric Péters il y a plus de 8 ans

Voilà un second patch, avec des tests supplémentaires.

Pour le premier c'est ok mais il lui faut un autre sujet, "misc: don't lose query string in variadic URL (#8889)".

#8

Mis à jour par Thomas Noël il y a plus de 8 ans

  • Statut changé de En cours à Résolu (à déployer)
  • Version cible mis à v1.22
commit 6cf22249aa3da06ab5d26164a403be548f719bdf
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Fri Nov 6 10:20:10 2015 +0100

    misc: extend variadic URL to support even more variations (#8889)

commit 143d432905140feeb908df235f62e48f2bef56a9
Author: Thomas NOEL <tnoel@entrouvert.com>
Date:   Fri Nov 6 00:03:37 2015 +0100

    misc: don't lose query string in variadic URL (#8889)

#9

Mis à jour par Frédéric Péters il y a plus de 8 ans

  • Statut changé de Résolu (à déployer) à Fermé

Formats disponibles : Atom PDF