Skip to contentSkip to conversation

view: fix unquote_plus import

PATCH In review [email protected] 2 participants 3 messages Apr 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 view: fix unquote_plus import

From: Thomas Perrot <[email protected]>

The "unquote_plus" function is provided by the "urllib.parse" module in Python 3.

---
 Post/views.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Post/views.py +2 -2
index 3575c1da9854..c0538fd4927e 100644
@@ -57,7 +57,7 @@ def addData(request, return_json=False):
             # Backward compatibility with send-error-report < 0.3
             # The json is url encoded so we need to undo this here.
             data = request.body[len('data='):]
-            data = urllib.unquote_plus(data)
+            data = urllib.parse.unquote_plus(data)
 
         p = Parser(data)
         result = p.parse(request)
@@ -96,7 +96,7 @@ def apply_filter(context, items, name, value):
         if ':' in value:
             recipe = value.split(':')[0].strip()
             task = value.split(':')[1].strip()
-            filters.append(('TASK', task)) 
+            filters.append(('TASK', task))
             filters.append(('RECIPE', recipe))
         else:
             filters.append(('TASK', value))
Signature · 1 line
2.49.0
#1 lore raw
Quoted 15 lines · Thomas Perrot via lists.yoctoproject.org

From: Thomas Perrot <[email protected]>

The "unquote_plus" function is provided by the "urllib.parse" module in Python 3.

---
 Post/views.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Post/views.py +0 -0
index 3575c1da9854..c0538fd4927e 100644

Post/views.py def addData(request, return_json=False): · line 60

Quoted 5 lines
Post/views.py +1 -1
@@ -57,7 +57,7 @@ def addData(request, return_json=False):
             # Backward compatibility with send-error-report < 0.3
             # The json is url encoded so we need to undo this here.
             data = request.body[len('data='):]
-            data = urllib.unquote_plus(data)
+            data = urllib.parse.unquote_plus(data)

Looking at this a bit more, while this is definitely a bug, you should also check the "if" condition. The else branch seems to be there for backwards compatibility for old scripts, and you want to use the true branch, me thinks

Quoted 21 lines
Post/views.py +1 -2
         p = Parser(data)
         result = p.parse(request)
@@ -96,7 +96,7 @@ def apply_filter(context, items, name, value):
         if ':' in value:
             recipe = value.split(':')[0].strip()
             task = value.split(':')[1].strip()
-            filters.append(('TASK', task)) 
+            filters.append(('TASK', task))
             filters.append(('RECIPE', recipe))
         else:
             filters.append(('TASK', value))
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#65188): https://lists.yoctoproject.org/g/yocto/message/65188
Mute This Topic: https://lists.yoctoproject.org/mt/112294515/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 21 lines · Gyorgy Sarvari
Quoted 20 lines · Thomas Perrot via lists.yoctoproject.org

From: Thomas Perrot <[email protected]>

The "unquote_plus" function is provided by the "urllib.parse" module in Python 3.

---
 Post/views.py | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
Post/views.py +0 -0
index 3575c1da9854..c0538fd4927e 100644
@@ -57,7 +57,7 @@ def addData(request, return_json=False):
              # Backward compatibility with send-error-report < 0.3
              # The json is url encoded so we need to undo this

here.
             data = request.body[len('data='):]
-            data = urllib.unquote_plus(data)

Quoted 8 lines
Quoted 1 line

+            data = urllib.parse.unquote_plus(data)

Looking at this a bit more, while this is definitely a bug, you should
also check the "if" condition. The else branch seems to be there for backwards compatibility for old scripts, and you want to use the true branch, me thinks

I'm working on fixing it.

Kind regards,
Thomas Perrot

Quoted 27 lines
Quoted 27 lines


         p = Parser(data)
         result = p.parse(request)

Post/views.py +0 -0
@@ -96,7 +96,7 @@ def apply_filter(context, items, name, value):

         if ':' in value:
             recipe = value.split(':')[0].strip()
             task = value.split(':')[1].strip()
-            filters.append(('TASK', task))
+            filters.append(('TASK', task))
             filters.append(('RECIPE', recipe))
         else:
             filters.append(('TASK', value))

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#65188):
https://lists.yoctoproject.org/g/yocto/message/65188
Mute This Topic:
https://lists.yoctoproject.org/mt/112294515/6084445
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/yocto/unsub [[email protected]
]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Thomas Perrot, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com