Skip to content

Commit

Permalink
fix: try path failed with folder (#5)
Browse files Browse the repository at this point in the history
* fix: try path failed with folder

* doc: update conf
  • Loading branch information
0fatal authored Aug 15, 2023
1 parent a29e1a9 commit 8fbe59e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions go-plugins/cmd/go-runner/plugins/try_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func tryPath(host, path string) (bool, error) {
return false, err
}
defer resp.Body.Close()
if resp.StatusCode != 404 && resp.StatusCode != 403 {
return true, nil
if resp.StatusCode == 404 || resp.StatusCode == 403 || resp.StatusCode == 400 || resp.Header.Get("Content-Type") == "folder" {
return false, nil
}
return false, nil
return true, nil
}
2 changes: 1 addition & 1 deletion go-plugins/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ value: value is a string (serialized JSON object) that contains `paths` and `hos
```json
{
"name": "try-path",
"value": "{\"path\":[\"$uri\",\"$uri/\",\"index.html\"],\"host\":\"http://hostname\"}"
"value": "{\"paths\":[\"$uri\", \"$uri/\", \"$uriindex.html\", \"$uri/index.html\"], \"host\":\"http://hostname\"}"
}
```

0 comments on commit 8fbe59e

Please sign in to comment.