Compare commits

..

3 Commits

Author SHA1 Message Date
Andy Hsu
b7ae56b109 ci: delete beta tag before generating changelog 2024-09-14 00:50:24 +08:00
Andy Hsu
5d9167d676 fix: recover panic on storage init 2024-09-13 23:50:51 +08:00
jindongh
1b42b9627c fix(google_photo): fix issue copy videos from google photo (#7160 close #7158)
#7158 During copy from google photo to aliyun, it failed consistently with 404 when copying mp4 file with =m37.

Change =m37 to =dv will fix the issue
2024-09-12 19:08:13 +08:00
5 changed files with 30 additions and 29 deletions

View File

@@ -29,12 +29,17 @@ jobs:
ref: tags/beta ref: tags/beta
sha: ${{ github.sha }} sha: ${{ github.sha }}
- name: Delete beta tag
run: git tag -d beta
continue-on-error: true
- name: changelog # or changelogithub@0.12 if ensure the stable result - name: changelog # or changelogithub@0.12 if ensure the stable result
id: changelog id: changelog
run: | run: |
git tag -l git tag -l
npx changelogithub --output CHANGELOG.md npx changelogithub --output CHANGELOG.md
# npx changelogen@latest --output CHANGELOG.md # npx changelogen@latest --output CHANGELOG.md
- name: Upload assets - name: Upload assets
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:

View File

@@ -15,6 +15,10 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Delete beta tag
run: git tag -d beta
continue-on-error: true
- run: npx changelogithub # or changelogithub@0.12 if ensure the stable result - run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
env: env:
GITHUB_TOKEN: ${{secrets.MY_TOKEN}} GITHUB_TOKEN: ${{secrets.MY_TOKEN}}

View File

@@ -58,33 +58,9 @@ func (d *GooglePhoto) Link(ctx context.Context, file model.Obj, args model.LinkA
URL: f.BaseURL + "=d", URL: f.BaseURL + "=d",
}, nil }, nil
} else if strings.Contains(f.MimeType, "video/") { } else if strings.Contains(f.MimeType, "video/") {
var width, height int return &model.Link{
URL: f.BaseURL + "=dv",
fmt.Sscanf(f.MediaMetadata.Width, "%d", &width) }, nil
fmt.Sscanf(f.MediaMetadata.Height, "%d", &height)
switch {
// 1080P
case width == 1920 && height == 1080:
return &model.Link{
URL: f.BaseURL + "=m37",
}, nil
// 720P
case width == 1280 && height == 720:
return &model.Link{
URL: f.BaseURL + "=m22",
}, nil
// 360P
case width == 640 && height == 360:
return &model.Link{
URL: f.BaseURL + "=m18",
}, nil
default:
return &model.Link{
URL: f.BaseURL + "=dv",
}, nil
}
} }
return &model.Link{}, nil return &model.Link{}, nil
} }

2
go.mod
View File

@@ -31,7 +31,6 @@ require (
github.com/go-resty/resty/v2 v2.14.0 github.com/go-resty/resty/v2 v2.14.0
github.com/go-webauthn/webauthn v0.11.1 github.com/go-webauthn/webauthn v0.11.1
github.com/golang-jwt/jwt/v4 v4.5.0 github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3 github.com/gorilla/websocket v1.5.3
github.com/hirochachacha/go-smb2 v1.1.0 github.com/hirochachacha/go-smb2 v1.1.0
@@ -135,6 +134,7 @@ require (
github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/go-webauthn/x v0.1.12 // indirect github.com/go-webauthn/x v0.1.12 // indirect
github.com/goccy/go-json v0.10.2 // indirect github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
github.com/golang/protobuf v1.5.4 // indirect github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect github.com/golang/snappy v0.0.4 // indirect

View File

@@ -2,6 +2,8 @@ package op
import ( import (
"context" "context"
"fmt"
"runtime"
"sort" "sort"
"strings" "strings"
"time" "time"
@@ -83,11 +85,25 @@ func LoadStorage(ctx context.Context, storage model.Storage) error {
return err return err
} }
func getCurrentGoroutineStack() string {
buf := make([]byte, 1<<16)
n := runtime.Stack(buf, false)
return string(buf[:n])
}
// initStorage initialize the driver and store to storagesMap // initStorage initialize the driver and store to storagesMap
func initStorage(ctx context.Context, storage model.Storage, storageDriver driver.Driver) (err error) { func initStorage(ctx context.Context, storage model.Storage, storageDriver driver.Driver) (err error) {
storageDriver.SetStorage(storage) storageDriver.SetStorage(storage)
driverStorage := storageDriver.GetStorage() driverStorage := storageDriver.GetStorage()
defer func() {
if err := recover(); err != nil {
errInfo := fmt.Sprintf("[panic] err: %v\nstack: %s\n", err, getCurrentGoroutineStack())
log.Errorf("panic init storage: %s", errInfo)
driverStorage.SetStatus(errInfo)
MustSaveDriverStorage(storageDriver)
storagesMap.Delete(driverStorage.MountPath)
}
}()
// Unmarshal Addition // Unmarshal Addition
err = utils.Json.UnmarshalFromString(driverStorage.Addition, storageDriver.GetAddition()) err = utils.Json.UnmarshalFromString(driverStorage.Addition, storageDriver.GetAddition())
if err == nil { if err == nil {