[skip ci] req id tripping
This commit is contained in:
1 parent
b4a4a688ca
commit
007607e21c
1 file changed
+22
-9
@@ -138,23 +138,36 @@ namespace Sentry
|
|||||||
|
|
||||||
function ReplaceRequestId(message as string) as string
|
function ReplaceRequestId(message as string) as string
|
||||||
reqIdStart = `\nRequestId: `
|
reqIdStart = `\nRequestId: `
|
||||||
requestIdIndex = message.InStr(reqIdStart)
|
reqIdPlaceholder = "<REQUEST_ID>"
|
||||||
|
result = message
|
||||||
|
replaced = false
|
||||||
|
searchIndex = 0
|
||||||
|
while true
|
||||||
|
requestIdIndex = result.InStr(searchIndex, reqIdStart)
|
||||||
if requestIdIndex = -1
|
if requestIdIndex = -1
|
||||||
return invalid
|
exit while
|
||||||
end if
|
|
||||||
|
|
||||||
newLineIndex = message.InStr(requestIdIndex + reqIdStart.Len(), `\n`)
|
|
||||||
if newLineIndex = -1
|
|
||||||
return invalid
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
reqIdStartIndex = requestIdIndex + reqIdStart.Len()
|
reqIdStartIndex = requestIdIndex + reqIdStart.Len()
|
||||||
|
newLineIndex = result.InStr(reqIdStartIndex, `\n`)
|
||||||
|
if newLineIndex = -1
|
||||||
|
exit while
|
||||||
|
end if
|
||||||
|
|
||||||
reqIdEndIndex = newLineIndex - 1
|
reqIdEndIndex = newLineIndex - 1
|
||||||
if (reqIdEndIndex <= reqIdStartIndex) or ((reqIdEndIndex - reqIdStartIndex) > 20)
|
if (reqIdEndIndex <= reqIdStartIndex) or ((reqIdEndIndex - reqIdStartIndex) > 20)
|
||||||
|
exit while
|
||||||
|
end if
|
||||||
|
|
||||||
|
result = result.Mid(0, reqIdStartIndex) + reqIdPlaceholder + result.Mid(reqIdEndIndex + 1)
|
||||||
|
replaced = true
|
||||||
|
searchIndex = reqIdStartIndex + reqIdPlaceholder.Len()
|
||||||
|
end while
|
||||||
|
|
||||||
|
if not replaced
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
fingerprint = message.Mid(0, reqIdStartIndex) + "<REQUEST_ID>" + message.Mid(reqIdEndIndex + 1)
|
return result
|
||||||
return fingerprint
|
|
||||||
end function
|
end function
|
||||||
end namespace
|
end namespace
|
||||||
Reference in new issue
Block a user