Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/manager/src/features/ObjectStorage/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ const mockHostname = 'my-bucket.linodeobjects.com';
describe('Object Storage utilities', () => {
describe('generateObjectUrl', () => {
it('returns the correct URL', () => {
expect(generateObjectUrl(mockHostname, 'my-object')).toBe(
'https://my-bucket.linodeobjects.com/my-object'
expect(generateObjectUrl(mockHostname, 'my-folder/my-object')).toBe(
'https://my-bucket.linodeobjects.com/my-folder/my-object'
);
});
it('encodes the URL for special characters', () => {
expect(generateObjectUrl(mockHostname, 'my-object?')).toBe(
'https://my-bucket.linodeobjects.com/my-object%3F'
expect(generateObjectUrl(mockHostname, 'my-object!@#$%^&*()_+<>.,')).toBe(
'https://my-bucket.linodeobjects.com/my-object!@#$%25%5E&*()_+%3C%3E.,'
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/features/ObjectStorage/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { ObjectStorageEndpoint } from '@linode/api-v4/lib/object-storage';
import type { FormikProps } from 'formik';

export const generateObjectUrl = (hostname: string, objectName: string) => {
return `https://${hostname}/${encodeURIComponent(objectName)}`;
return `https://${hostname}/${encodeURI(objectName)}`;
};

// Objects ending with a / and having a size of 0 are often used to represent
Expand Down