Skip to content

Commit 092133e

Browse files
committed
fix: 불필요 param userid제거
1 parent 4cc2bc0 commit 092133e

File tree

6 files changed

+14
-106
lines changed

6 files changed

+14
-106
lines changed

apps/storybook/scripts/fetchNotionBlocks.js

Lines changed: 0 additions & 80 deletions
This file was deleted.

apps/storybook/src/sample-data/notionBlocks.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"type": "file",
7070
"file": {
7171
"url": "https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fcd7314a5-d906-43b0-81e7-42eff82c02a3%2F566f127b-9e73-491d-bee6-5afd075653a2%2Fimage.png?table=block&id=17f9c6bf-2b17-8016-bf79-dc83ab79fb78&cache=v2",
72-
"expiry_time": "2025-03-19T14:54:05.767Z"
72+
"expiry_time": "2025-03-19T16:01:15.810Z"
7373
}
7474
}
7575
},
@@ -845,7 +845,7 @@
845845
"page_id": "1239c6bf-2b17-8076-a838-d17ca1c89783"
846846
},
847847
"created_time": "2024-10-18T08:07:00.000Z",
848-
"last_edited_time": "2025-03-19T13:01:00.000Z",
848+
"last_edited_time": "2025-03-19T14:10:00.000Z",
849849
"created_by": {
850850
"object": "user",
851851
"id": "5146391e-8b65-47f2-83b6-2bfe81194f32"
@@ -4561,7 +4561,7 @@
45614561
"type": "file",
45624562
"file": {
45634563
"url": "https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fcd7314a5-d906-43b0-81e7-42eff82c02a3%2F10d9f59d-d3e2-429a-ad72-c8b15b1f536b%2Fimage.png?table=block&id=1809c6bf-2b17-8096-aaf4-d89c3850bed0&cache=v2",
4564-
"expiry_time": "2025-03-19T14:54:05.937Z"
4564+
"expiry_time": "2025-03-19T16:01:16.374Z"
45654565
}
45664566
}
45674567
},

packages/notion-to-utils/src/client/formatNotionImageUrl.spec.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ describe('formatNotionImageUrl', () => {
3030
const s3Url =
3131
'https://prod-files-secure.s3.us-west-2.amazonaws.com/cd7314a5-d906-43b0-81e7-42eff82c02a3/566f127b-9e73-491d-bee6-5afd075653a2/image.png';
3232
const blockId = '17f9c6bf-2b17-8016-bf79-dc83ab79fb78';
33-
const userId = '5146391e-8b65-47f2-83b6-2bfe81194f32';
3433

35-
const expected = `https://www.notion.so/image/${encodeURIComponent(s3Url)}?table=block&id=${blockId}&userId=${userId}&cache=v2`;
34+
const expected = `https://www.notion.so/image/${encodeURIComponent(s3Url)}?table=block&id=${blockId}&cache=v2`;
3635

37-
const result = formatNotionImageUrl(s3Url, blockId, userId);
36+
const result = formatNotionImageUrl(s3Url, blockId);
3837

3938
expect(result).toBe(expected);
4039
});
@@ -114,8 +113,7 @@ describe('getFormattedImageUrlFromBlock', () => {
114113

115114
const expectedUrl = formatNotionImageUrl(
116115
mockBlock.image.file.url,
117-
mockBlock.id,
118-
mockBlock.last_edited_by.id
116+
mockBlock.id
119117
);
120118

121119
const result = getFormattedImageUrlFromBlock(mockBlock);
@@ -139,8 +137,7 @@ describe('getFormattedImageUrlFromBlock', () => {
139137

140138
const expectedUrl = formatNotionImageUrl(
141139
mockBlock.image.external.url,
142-
mockBlock.id,
143-
mockBlock.last_edited_by.id
140+
mockBlock.id
144141
);
145142

146143
const result = getFormattedImageUrlFromBlock(mockBlock);
@@ -186,7 +183,7 @@ describe('getFormattedImageUrlFromBlock', () => {
186183
file: {
187184
get url() {
188185
throw new Error('액세스 오류');
189-
}
186+
},
190187
},
191188
},
192189
};

packages/notion-to-utils/src/client/formatNotionImageUrl.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
*/
1616
export const formatNotionImageUrl = (
1717
url: string | undefined,
18-
blockId?: string,
19-
userId?: string | undefined
18+
blockId?: string
2019
): string => {
2120
// URL이 없거나 유효하지 않은 경우 빈 문자열 또는 원래 URL 반환
2221
if (!url || typeof url !== 'string' || !url.startsWith('https://')) {
@@ -85,8 +84,7 @@ export const getFormattedImageUrlFromBlock = (block: any): string | null => {
8584
// expiry_time 필드가 있는 경우에도 무시하고 URL만 사용
8685
// URL에서 기본 이미지 경로만 추출하여 사용
8786
const blockId = block.id;
88-
const userId = block.last_edited_by?.id;
89-
return formatNotionImageUrl(url, blockId, userId);
87+
return formatNotionImageUrl(url, blockId);
9088
}
9189
}
9290

packages/notion-to-utils/src/client/getPageBlocks.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,19 @@ async function fetchBlockChildren(
6565
// file URL 처리
6666
if (imageBlock.image.file && imageBlock.image.file.url) {
6767
const url = imageBlock.image.file.url;
68-
const userId = imageBlock.last_edited_by?.id;
6968
// 포맷팅된 URL로 교체
70-
imageBlock.image.file.url = formatNotionImageUrl(
71-
url,
72-
block.id,
73-
userId
74-
);
69+
imageBlock.image.file.url = formatNotionImageUrl(url, block.id);
7570
}
7671
// external URL 처리
7772
else if (
7873
imageBlock.image.external &&
7974
imageBlock.image.external.url
8075
) {
8176
const url = imageBlock.image.external.url;
82-
const userId = imageBlock.last_edited_by?.id;
8377
// 포맷팅된 URL로 교체
8478
imageBlock.image.external.url = formatNotionImageUrl(
8579
url,
86-
block.id,
87-
userId
80+
block.id
8881
);
8982
}
9083
}

packages/notion-to-utils/src/client/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export class Client extends NotionClient {
1515
getFileUrl = (pageId: string, propertyKey: string) =>
1616
getFileUrlFunc(this, pageId, propertyKey);
1717
getPageBlocks = (pageId: string) => getPageBlocksFunc(this, pageId);
18-
formatNotionImageUrl = (url: string, blockId?: string, userId?: string) =>
19-
formatNotionImageUrlFunc(url, blockId, userId);
18+
formatNotionImageUrl = (url: string, blockId?: string) =>
19+
formatNotionImageUrlFunc(url, blockId);
2020
}
2121

2222
export default Client;

0 commit comments

Comments
 (0)