Skip to content

Commit e11b8a8

Browse files
authored
fix(drivers/cloudreve_v4): remove token check for share (#2274)
Fixed the issue of token verification for shared links.
1 parent 12c9bdb commit e11b8a8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/cloudreve_v4/driver.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ func (d *CloudreveV4) Init(ctx context.Context) error {
4646
if d.ref != nil {
4747
return nil
4848
}
49+
if d.isShare() {
50+
return nil
51+
}
4952
if d.canLogin() {
5053
return d.login()
5154
}

drivers/cloudreve_v4/util.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const (
3333
CodeLoginRequired = http.StatusUnauthorized
3434
CodePathNotExist = 40016 // Path not exist
3535
CodeCredentialInvalid = 40020 // Failed to issue token
36+
// IncorrectSharePassword = 40069 // Incorrect share password
3637
)
3738

3839
var (
@@ -277,9 +278,16 @@ func (d *CloudreveV4) parseJWT(token string, jwt any) error {
277278
return nil
278279
}
279280

281+
func (d *CloudreveV4) isShare() bool {
282+
return strings.HasSuffix(d.GetRootPath(), "@share")
283+
}
284+
280285
// check if token is expired
281286
// https://github.com/cloudreve/frontend/blob/ddfacc1c31c49be03beb71de4cc114c8811038d6/src/session/index.ts#L177-L200
282287
func (d *CloudreveV4) isTokenExpired() bool {
288+
if d.isShare() {
289+
return false
290+
}
283291
if d.RefreshToken == "" {
284292
// login again if username and password is set
285293
if d.canLogin() {

0 commit comments

Comments
 (0)