AlistGo/alist · error

Failed to get file link

Error message

Failed to get file link

What it means

handleTempDownload failed to fetch the Proton Drive link for the tokenized file via GetLink while serving a temporary download, answering HTTP 500. Means the underlying drive lookup errored (network, permissions, deleted link).

Solutions

  1. Check the storage configuration and the provider's service status, fix the indicated cause, and retry the operation.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at drivers/proton_drive/util.go:187 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/cbc351b622bd37c8. Report an issue: GitHub.

Appendix: source

Thrown at drivers/proton_drive/util.go:187

	return nil
}

func (d *ProtonDrive) handleTempDownload(w http.ResponseWriter, r *http.Request) {
	token := strings.TrimPrefix(r.URL.Path, "/temp/")

	d.tokenMutex.RLock()
	info, exists := d.downloadTokens[token]
	d.tokenMutex.RUnlock()

	if !exists {
		http.Error(w, "Invalid or expired token", http.StatusNotFound)
		return
	}

	link, err := d.protonDrive.GetLink(r.Context(), info.LinkID)
	if err != nil {
		http.Error(w, "Failed to get file link", http.StatusInternalServerError)
		return
	}

	// Get file size for range calculations
	_, _, attrs, err := d.protonDrive.DownloadFile(r.Context(), link, 0)
	if err != nil {
		http.Error(w, "Failed to get file info", http.StatusInternalServerError)
		return
	}

	fileSize := attrs.Size

	rangeHeader := r.Header.Get("Range")
	if rangeHeader != "" {

		// Parse range header like "bytes=0-1023" or "bytes=1024-"
		ranges, err := parseRange(rangeHeader, fileSize)
		if err != nil {

View on GitHub (pinned to 843d9dc814)