Skip to content

Commit 519b92c

Browse files
fix(release): Quote release search term in Issue GroupList links (#97619)
We need to quote the release name because it could contain spaces. The quotes will make the url look like `?query=release%3A"my%20release%401.2.3"`, unescaped it's `?query=release:"my [email protected]"` Previously, without the quotes, the issue details page would parse the query to be `release:my` instead of `release: "my [email protected]"` Fixes https://linear.app/getsentry/issue/REPLAY-604/improve-handling-of-improperly-formatted-release-names --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 433839b commit 519b92c

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

static/app/views/releases/detail/overview/releaseIssues.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ describe('ReleaseIssues', function () {
179179

180180
const link = await screen.findByRole('link', {name: /RequestError/});
181181

182-
// Should pass the query param `query` with value `release:1.0.0`
182+
// Should pass the query param `query` with value `release:"1.0.0"`
183183
expect(link).toHaveAttribute(
184184
'href',
185-
'/organizations/org-slug/issues/123/?_allp=1&project=2&query=release%3A1.0.0&referrer=release-issue-stream'
185+
'/organizations/org-slug/issues/123/?_allp=1&project=2&query=release%3A%221.0.0%22&referrer=release-issue-stream'
186186
);
187187
});
188188
});

static/app/views/releases/detail/overview/releaseIssues.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {DEFAULT_RELATIVE_PERIODS} from 'sentry/constants';
1515
import {t, tct} from 'sentry/locale';
1616
import {space} from 'sentry/styles/space';
1717
import type {Organization} from 'sentry/types/organization';
18+
import {escapeDoubleQuotes} from 'sentry/utils';
1819
import {browserHistory} from 'sentry/utils/browserHistory';
1920
import {DemoTourElement, DemoTourStep} from 'sentry/utils/demoMode/demoTours';
2021
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
@@ -407,7 +408,7 @@ class ReleaseIssues extends Component<Props, State> {
407408
<GroupList
408409
endpointPath={path}
409410
queryParams={queryParams}
410-
query={`release:${version}`}
411+
query={`release:"${escapeDoubleQuotes(version)}"`}
411412
canSelectGroups={false}
412413
queryFilterDescription={queryFilterDescription}
413414
withChart={withChart}

static/app/views/releases/drawer/newIssues.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import GroupList from 'sentry/components/issues/groupList';
22
import {t} from 'sentry/locale';
3+
import {escapeDoubleQuotes} from 'sentry/utils';
34
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
45
import {useLocation} from 'sentry/utils/useLocation';
56
import useOrganization from 'sentry/utils/useOrganization';
@@ -28,7 +29,9 @@ export function NewIssues({release, projectId, withChart = false}: Props) {
2829
limit: 10,
2930
sort: IssueSortOptions.FREQ,
3031
groupStatsPeriod: 'auto',
31-
query: new MutableSearch([`first-release:${release}`]).formatString(),
32+
query: new MutableSearch([
33+
`first-release:"${escapeDoubleQuotes(release)}"`,
34+
]).formatString(),
3235
};
3336

3437
const renderEmptyMessage = () => {
@@ -39,7 +42,11 @@ export function NewIssues({release, projectId, withChart = false}: Props) {
3942
<GroupList
4043
endpointPath={path}
4144
queryParams={queryParams}
42-
query={`release:${releaseDetails?.versionInfo.version.raw}`}
45+
query={
46+
releaseDetails
47+
? `release:"${escapeDoubleQuotes(releaseDetails?.versionInfo.version.raw)}"`
48+
: ''
49+
}
4350
canSelectGroups={false}
4451
withChart={withChart}
4552
renderEmptyMessage={renderEmptyMessage}

0 commit comments

Comments
 (0)