Skip to content

Commit 8dffee6

Browse files
committed
More specific regex for gid
1 parent d64bd8c commit 8dffee6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/app/src/cli/services/bulk-operations/bulk-operation-status.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ describe('extractBulkOperationId', () => {
6565
})
6666

6767
test('returns input as-is if not a valid GID format', () => {
68+
expect(extractBulkOperationId('gid://shopify/BulkOperation/ABC')).toBe('gid://shopify/BulkOperation/ABC')
69+
expect(extractBulkOperationId('BulkOperation/123')).toBe('BulkOperation/123')
6870
expect(extractBulkOperationId('invalid-id')).toBe('invalid-id')
6971
expect(extractBulkOperationId('123')).toBe('123')
7072
})

packages/app/src/cli/services/bulk-operations/bulk-operation-status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function normalizeBulkOperationId(id: string): string {
3838

3939
export function extractBulkOperationId(gid: string): string {
4040
// Extract the numeric ID from a GID like "gid://shopify/BulkOperation/123"
41-
const match = gid.match(/\/BulkOperation\/(\d+)$/)
41+
const match = gid.match(/^gid:\/\/shopify\/BulkOperation\/(\d+)$/)
4242
return match?.[1] ?? gid
4343
}
4444

0 commit comments

Comments
 (0)