From c2780796c0fb1f9cf2a8b535d689a4b5743a09cc Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Tue, 7 Nov 2023 18:20:49 -0800 Subject: [PATCH] fix(systemtags): Cast tag display name to string Signed-off-by: Christopher Ng --- apps/systemtags/src/services/api.ts | 4 ++-- apps/systemtags/src/services/files.ts | 4 ++-- apps/systemtags/src/utils.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/systemtags/src/services/api.ts b/apps/systemtags/src/services/api.ts index 0e3b7e09c6e..4872036fa92 100644 --- a/apps/systemtags/src/services/api.ts +++ b/apps/systemtags/src/services/api.ts @@ -31,7 +31,7 @@ import { davClient } from './davClient.js' import { formatTag, parseIdFromLocation, parseTags } from '../utils' import { logger } from '../logger.js' -export const fetchTagsBody = ` +export const fetchTagsPayload = ` @@ -46,7 +46,7 @@ export const fetchTags = async (): Promise => { const path = '/systemtags' try { const { data: tags } = await davClient.getDirectoryContents(path, { - data: fetchTagsBody, + data: fetchTagsPayload, details: true, glob: '/systemtags/*', // Filter out first empty tag }) as ResponseDataDetailed[]> diff --git a/apps/systemtags/src/services/files.ts b/apps/systemtags/src/services/files.ts index 7dbd04c5350..35a087d04d1 100644 --- a/apps/systemtags/src/services/files.ts +++ b/apps/systemtags/src/services/files.ts @@ -24,7 +24,7 @@ import type { FileStat, ResponseDataDetailed } from 'webdav' import type { ServerTagWithId, Tag, TagWithId } from '../types.js' import { davClient } from './davClient.js' -import { createTag, fetchTagsBody } from './api.js' +import { createTag, fetchTagsPayload } from './api.js' import { formatTag, parseTags } from '../utils.js' import { logger } from '../logger.js' @@ -32,7 +32,7 @@ export const fetchTagsForFile = async (fileId: number): Promise => const path = '/systemtags-relations/files/' + fileId try { const { data: tags } = await davClient.getDirectoryContents(path, { - data: fetchTagsBody, + data: fetchTagsPayload, details: true, glob: '/systemtags-relations/files/*/*', // Filter out first empty tag }) as ResponseDataDetailed[]> diff --git a/apps/systemtags/src/utils.ts b/apps/systemtags/src/utils.ts index c72c5975f03..602594199aa 100644 --- a/apps/systemtags/src/utils.ts +++ b/apps/systemtags/src/utils.ts @@ -35,7 +35,7 @@ export const defaultBaseTag: BaseTag = { export const parseTags = (tags: { props: DAVResultResponseProps }[]): TagWithId[] => { return tags.map(({ props }) => Object.fromEntries( Object.entries(props) - .map(([key, value]) => [camelCase(key), value]), + .map(([key, value]) => [camelCase(key), camelCase(key) === 'displayName' ? String(value) : value]), )) as TagWithId[] } -- 2.39.5