MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / quote_more

Function quote_more

aboutcode/hashid/__init__.py:306–326  ·  view source on GitHub ↗

Return a quoted string from ``qs`` string by quoting all non-quoted characters ignoring already quoted characters. This makes the quoted string safer to use in a path. For example:: >>> quote_more("foo") 'foo' >>> quote_more("foo/bar") 'foo%2Fbar' >>> quote_more("

(qs)

Source from the content-addressed store, hash-verified

304
305
306def quote_more(qs):
307 """
308 Return a quoted string from ``qs`` string by quoting all non-quoted characters ignoring already
309 quoted characters. This makes the quoted string safer to use in a path.
310
311 For example::
312 >>> quote_more("foo")
313 'foo'
314
315 >>> quote_more("foo/bar")
316 'foo%2Fbar'
317
318 >>> quote_more("foo%2Fbar")
319 'foo%2Fbar'
320 """
321 if not qs:
322 return qs
323 try:
324 return quote(qs, safe="%")
325 except Exception as e:
326 raise Exception(f"Failed to quote_more: {qs!r}") from e
327
328
329def get_core_purl(purl: Union[PackageURL, str]):

Callers 1

package_path_elementsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected