sentry icon indicating copy to clipboard operation
sentry copied to clipboard

fix(stacktrace-link): Fix gitlab integration url being incorrectly generated

Open MichaelSun48 opened this issue 1 year ago • 3 comments

Fixes an issue where gitlab urls were not being formatted correctly. Specifically:

  • We were not stripping filepaths of their trailing slash
  • We did change the url generation logic to parse backslashes correctly after Windows code mappings were supported

MichaelSun48 avatar Jun 28 '24 19:06 MichaelSun48

@MichaelSun48 could you add a test to verify that backslashes will work with stack trace linking? I'm not sure this is the right place since the request to check if a file exists is in the gitlab client check_file() which doesn't look like it calls this function.

I think the right place to do this would be in convert_stacktrace_frame_path_to_source_path so that the transformation happens earlier.

malwilley avatar Jun 28 '24 19:06 malwilley

@malwilley Thanks for the call out! After digging into it I'm pretty sure you're right – I added a test and modified convert_stacktrace_frame_path_to_source_path to support backslash paths and code mappings

MichaelSun48 avatar Jun 28 '24 20:06 MichaelSun48

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.02%. Comparing base (082f15e) to head (4e2bc31). Report is 49 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #73531      +/-   ##
==========================================
+ Coverage   70.49%   78.02%   +7.53%     
==========================================
  Files        6635     6638       +3     
  Lines      296699   296898     +199     
  Branches    51091    51127      +36     
==========================================
+ Hits       209150   231657   +22507     
+ Misses      80777    58967   -21810     
+ Partials     6772     6274     -498     
Files Coverage Δ
src/sentry/integrations/utils/code_mapping.py 89.31% <100.00%> (+12.79%) :arrow_up:

... and 1258 files with indirect coverage changes

codecov[bot] avatar Jun 28 '24 21:06 codecov[bot]