Skip to content

Instantly share code, notes, and snippets.

@Eveler
Created October 15, 2018 07:22
Show Gist options
  • Select an option

  • Save Eveler/36dd2588be55fd1c3f2260fde56821ba to your computer and use it in GitHub Desktop.

Select an option

Save Eveler/36dd2588be55fd1c3f2260fde56821ba to your computer and use it in GitHub Desktop.
URL-encoded attachment id resolve patch
Index: zeep/wsdl/messages/xop.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- zeep/wsdl/messages/xop.py (date 1539132819497)
+++ zeep/wsdl/messages/xop.py (date 1539132819497)
@@ -1,4 +1,5 @@
import base64
+from urllib.parse import unquote
def process_xop(document, message_pack):
@@ -11,12 +12,14 @@
for xop_node in xop_nodes:
href = xop_node.get('href')
+ href = unquote(href)
if href.startswith('cid:'):
href = '<%s>' % href[4:]
value = message_pack.get_by_content_id(href)
if not value:
- raise ValueError("No part found for: %r" % xop_node.get('href'))
+ raise ValueError("No part found for: %r" % unquote(
+ xop_node.get('href')))
num_replaced += 1
xop_parent = xop_node.getparent()
@tcvieira
Copy link

That did the trick! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment