flipped-aurora/gin-vue-admin · error

下载结果缺少 url

Error message

下载结果缺少 url

What it means

DownloadOnlineSkill POSTs to the gin-vue-admin plugin marketplace downloadSkill endpoint and unmarshals {data:{url}}. If the JSON parses but data.url is empty/whitespace, it returns "下载结果缺少 url" — the marketplace responded OK but did not provide a real download link (e.g. unknown plugin id/version or upstream change).

Source

Thrown at server/service/system/sys_skills.go:434

	}

	metaBody, err := io.ReadAll(downloadResp.Body)
	if err != nil {
		return fmt.Errorf("读取下载结果失败: %w", err)
	}

	var meta struct {
		Data struct {
			URL string `json:"url"`
		} `json:"data"`
	}
	if err = json.Unmarshal(metaBody, &meta); err != nil {
		return fmt.Errorf("解析下载结果失败: %w", err)
	}

	realDownloadURL := strings.TrimSpace(meta.Data.URL)
	if realDownloadURL == "" {
		return errors.New("下载结果缺少 url")
	}

	zipResp, err := http.Get(realDownloadURL)
	if err != nil {
		return fmt.Errorf("下载压缩包失败: %w", err)
	}
	defer zipResp.Body.Close()

	if zipResp.StatusCode != http.StatusOK {
		return fmt.Errorf("下载压缩包失败, HTTP状态码: %d", zipResp.StatusCode)
	}

	tmpFile, err := os.CreateTemp("", "gva-skill-*.zip")
	if err != nil {
		return fmt.Errorf("创建临时文件失败: %w", err)
	}
	tmpPath := tmpFile.Name()
	defer os.Remove(tmpPath)

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Verify the plugin ID and version against the current marketplace listing and retry
  2. Log/inspect the raw response body to see any msg/error field the marketplace returned
  3. Check https://plugin.gin-vue-admin.com availability and whether downloadSkill's response schema changed; update the struct if it did
  4. Fall back to manually packaging the skill locally and importing it

Example fix

// before
var meta struct { Data struct { URL string `json:"url"` } `json:"data"` }
// after (surface upstream message too)
var meta struct {
    Data struct { URL string `json:"url"` } `json:"data"`
    Msg  string `json:"msg"`
    Code int    `json:"code"`
}
if err = json.Unmarshal(metaBody, &meta); err != nil { ... }
if meta.Code != 0 { return fmt.Errorf("marketplace error: %s", meta.Msg) }
if strings.TrimSpace(meta.Data.URL) == "" { return errors.New("下载结果缺少 url: " + meta.Msg) }
Defensive patterns

Strategy: retry

Validate before calling

// pre-check: confirm id/version exist in the marketplace listing API before download
// and validate the ID is a known non-empty value client-side
if req.ID == 0 || req.Version == "" { return errors.New("请提供有效的插件ID和版本") }

Try / catch

if err := svc.DownloadOnlineSkill(ctx, req); err != nil {
    if err.Error() == "下载结果缺少 url" {
        // surface upstream msg, ask user to verify ID/version, allow retry
    }
    return err
}

Prevention

When it happens

Trigger: Downloading an online skill with an ID/Version that has no published artifact, or when the marketplace API returns a success envelope without a url field (schema change, deleted/unpublished skill).

Common situations: Stale plugin ID from an old listing; requesting a version that doesn't exist; marketplace service degradation returning an empty payload; the response shape being changed upstream.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/9e1eca2fca57faa0. Report an issue: GitHub.