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
2 changes: 1 addition & 1 deletion packages/arcgis-rest-portal/src/items/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export function decorateThumbnail(
if (typeof item.thumbnail === "string") {
thumbnailUrl = `${portal}/content/items/${item.id}/info/${item.thumbnail}`;
if (thumbnailUrl && item.access !== "public" && token) {
thumbnailUrl += `?${token}`;
thumbnailUrl += `?token=${token}`;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-portal/test/items/get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ describe("get", () => {
} as IAuthenticationManager;
const item = await getItem("3ef", { authentication: fakeAuthManager });
expect(item.thumbnailUrl).toBe(
"https://www.arcgis.com/sharing/rest/content/items/3ef/info/thumb.png?fake-token"
"https://www.arcgis.com/sharing/rest/content/items/3ef/info/thumb.png?token=fake-token"
);
});

Expand Down
32 changes: 32 additions & 0 deletions packages/arcgis-rest-portal/test/items/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,36 @@ describe("decorateThumbnail()", () => {
decorateThumbnail(undefined as any, "https://portal.com")
).toBeUndefined();
});

test("should decorate private item thumbnail with token parameter", () => {
const item = decorateThumbnail(
{
id: "3ef",
access: "private",
thumbnail: "thumb.png"
} as any,
"https://portal.com",
"fake-token"
);

expect(item.thumbnailUrl).toBe(
"https://portal.com/content/items/3ef/info/thumb.png?token=fake-token"
);
});

test("should not append token parameter for public item thumbnail", () => {
const item = decorateThumbnail(
{
id: "3ef",
access: "public",
thumbnail: "thumb.png"
} as any,
"https://portal.com",
"fake-token"
);

expect(item.thumbnailUrl).toBe(
"https://portal.com/content/items/3ef/info/thumb.png"
);
});
});
Loading