Skip to content

Commit 6e1be15

Browse files
committed
Redact urls in safe messages instead of ommiting
1 parent b921bb0 commit 6e1be15

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/RustyObjectStore.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,8 @@ function safe_message(e::Exception)
799799
if e isa RequestException
800800
msg = message(e)
801801
r = reason(e)
802-
if contains(msg, "<Error>") || contains(msg, "http")
803-
# Contains unreadacted payload from backend or urls, try extracting safe information
802+
if contains(msg, "<Error>")
803+
# Contains unreadacted payload from backend, try extracting safe information
804804
code, backend_msg, report = extract_safe_parts(message(e))
805805
reason_str = reason_description(r)
806806

@@ -809,6 +809,9 @@ function safe_message(e::Exception)
809809
retry_report = isnothing(report) ? "" : "\n\n$(report)"
810810

811811
return "$(backend_msg) (code: $(code), reason: $(reason_str))$(retry_report)"
812+
elseif contains(msg, "http")
813+
# Contains urls, redact them
814+
return replace(msg, r"https?://[^\n )]+" => "<redacted url>")
812815
else
813816
# Assuming it safe as it does not come from backend or has url, return message directly
814817
return msg

0 commit comments

Comments
 (0)