mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 05:56:31 +08:00
feat: encode publisher handle and template name in marketplace URLs for improved URL safety
This commit is contained in:
parent
98449de4f6
commit
22d22f2b77
@ -43,9 +43,12 @@ const TemplateCardComponent = ({
|
||||
templateId: id,
|
||||
creationType: 'templates',
|
||||
}
|
||||
const encodedPublisherHandle = encodeURIComponent(publisher_handle)
|
||||
const encodedTemplateName = encodeURIComponent(template_name)
|
||||
|
||||
return includeSource
|
||||
? getMarketplaceUrl(`/template/${publisher_handle}/${template_name}`, queryParams)
|
||||
: `${MARKETPLACE_URL_PREFIX}/template/${publisher_handle}/${template_name}?${buildSearchParamsString(queryParams)}`
|
||||
? getMarketplaceUrl(`/template/${encodedPublisherHandle}/${encodedTemplateName}`, queryParams)
|
||||
: `${MARKETPLACE_URL_PREFIX}/template/${encodedPublisherHandle}/${encodedTemplateName}?${buildSearchParamsString(queryParams)}`
|
||||
}, [publisher_handle, template_name, theme, locale, id, includeSource])
|
||||
|
||||
const visibleDepsPlugins = deps_plugins?.slice(0, MAX_VISIBLE_DEPS_PLUGINS) || []
|
||||
|
||||
@ -203,7 +203,7 @@ function TemplatesSection({ templates, includeSource, t }: {
|
||||
<DropdownItem
|
||||
key={template.id}
|
||||
href={buildMarketplaceHref(
|
||||
`/template/${template.publisher_handle}/${template.template_name}`,
|
||||
`/template/${encodeURIComponent(template.publisher_handle)}/${encodeURIComponent(template.template_name)}`,
|
||||
{ templateId: template.id },
|
||||
includeSource,
|
||||
)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user