AlistGo/alist · error

not find file sgin

Error message

not find file sgin

What it means

htmlFormToMap fails when the regex `data : '(.+?)'` finds no form payload in the LanZou HTML. Despite the typo ('sgin'), this is the 'file sign' — the encoded form parameters the driver must repost to reach the download page. Its absence means the expected intermediate page was not returned.

Source

Thrown at drivers/lanzou/help.go:296

	return param
}

func IsNumber(str string) bool {
	for _, s := range str {
		if !unicode.IsDigit(s) {
			return false
		}
	}
	return true
}

var findFromReg = regexp.MustCompile(`data : '(.+?)'`) // 查找from字符串

// 解析html中的form
func htmlFormToMap(html string) (map[string]string, error) {
	forms := findFromReg.FindStringSubmatch(html)
	if len(forms) != 2 {
		return nil, fmt.Errorf("not find file sgin")
	}
	return formToMap(forms[1]), nil
}

func formToMap(from string) map[string]string {
	var param = make(map[string]string)
	for _, kv := range strings.Split(from, "&") {
		kv := strings.SplitN(kv, "=", 2)[:2]
		param[kv[0]] = kv[1]
	}
	return param
}

var regExpirationTime = regexp.MustCompile(`e=(\d+)`)

func GetExpirationTime(url string) (etime time.Duration) {
	exps := regExpirationTime.FindStringSubmatch(url)
	if len(exps) < 2 {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Open the share link in a browser and walk the download flow manually to see the new steps (captcha/verification)
  2. Wait and retry later if the block is rate-limit based
  3. Update OpenList — the regex is periodically adjusted for LanZou changes; report HTML otherwise

Example fix

// before
var findFromReg = regexp.MustCompile(`data : '(.+?)'`)
// after (tolerate formatting drift in the marker)
var findFromReg = regexp.MustCompile(`data\s*:\s*'(.+?)'`)
Defensive patterns

Strategy: type-guard

Type guard

func hasLanzouFormSign(html string) bool {
    return findFromReg.MatchString(html)
}

Try / catch

params, err := htmlFormToMap(html)
if err != nil {
    if !hasLanzouFormSign(html) {
        return nil, fmt.Errorf("intermediate download page missing sign payload (new verification step?): %w", err)
    }
    return nil, err
}

Prevention

When it happens

Trigger: Requesting the file-sign step of a LanZou download where the returned page is not the expected form page: an error/verification page, a challenge page, or a template where the data-payload marker changed.

Common situations: LanZou download flow altered (extra verification step, sliding captcha); share link invalid/deleted; rate-limit block page returned mid-flow; frontend update changing whitespace so `data : '...'` no longer matches.

Related errors


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