mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-07 02:57:51 +00:00
fix(web): allow anonymous downloads for global PUBLIC skills (#473)
Use `namespace === 'global'` (without @ prefix) to match the actual route parameter value. The previous check used '@global' which never matched, causing anonymous users to be redirected to login even for global PUBLIC skills. Co-authored-by: dongmucat <1127093059qq.com>
This commit is contained in:
parent
8bd7a6bc1d
commit
2730d6470e
1 changed files with 7 additions and 1 deletions
|
|
@ -287,6 +287,11 @@ export function SkillDetailPage() {
|
|||
|
||||
// Download a single file from the skill version
|
||||
const handleDownloadFile = () => {
|
||||
const isAnonymousAllowed = namespace === 'global' && skill?.visibility === 'PUBLIC'
|
||||
if (!user && !isAnonymousAllowed) {
|
||||
requireLogin()
|
||||
return
|
||||
}
|
||||
if (!previewNode || !selectedVersion) return
|
||||
const cleanNamespace = namespace.startsWith('@') ? namespace.slice(1) : namespace
|
||||
const url = buildApiUrl(
|
||||
|
|
@ -302,7 +307,8 @@ export function SkillDetailPage() {
|
|||
}
|
||||
|
||||
const handleDownload = async () => {
|
||||
if (!user) {
|
||||
const isAnonymousAllowed = namespace === 'global' && skill?.visibility === 'PUBLIC'
|
||||
if (!user && !isAnonymousAllowed) {
|
||||
requireLogin()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue