mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-02-24 23:13:53 +08:00
sync-ui
This commit is contained in:
parent
91891d9798
commit
73a6035167
3 changed files with 14 additions and 9 deletions
|
@ -40,6 +40,7 @@ func InitDB() {
|
|||
LogLevel: logLevel,
|
||||
ParameterizedQueries: true,
|
||||
Colorful: true,
|
||||
IgnoreRecordNotFoundError: true,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -76,11 +76,12 @@ func (fs *FileService) CreateFile(c *gin.Context) (*schemas.FileOut, *types.AppE
|
|||
fileIn.Path = strings.TrimSpace(fileIn.Path)
|
||||
|
||||
if fileIn.Path != "" {
|
||||
var parent models.File
|
||||
if err := fs.Db.Where("type = ? AND path = ? AND user_id = ?", "folder", fileIn.Path, userId).First(&parent).Error; err != nil {
|
||||
return nil, fs.logAndReturn(bindJSONContext, err, http.StatusInternalServerError)
|
||||
|
||||
pathId, err := fs.getPathId(fileIn.Path, userId)
|
||||
if err != nil {
|
||||
return nil, fs.logAndReturn(listFilesContext, err, http.StatusNotFound)
|
||||
}
|
||||
fileDB.ParentID = parent.ID
|
||||
fileDB.ParentID = pathId
|
||||
}
|
||||
|
||||
if fileIn.Type == "folder" {
|
||||
|
@ -583,6 +584,7 @@ func (fs *FileService) GetFileStream(c *gin.Context) {
|
|||
tgClient, _ := tgc.UserLogin(c, session.Session)
|
||||
client, err = fs.worker.UserWorker(tgClient, session.UserId)
|
||||
if err != nil {
|
||||
fs.log.Error("file stream", zap.Error(err))
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
@ -601,6 +603,7 @@ func (fs *FileService) GetFileStream(c *gin.Context) {
|
|||
client, index, err = fs.worker.Next(file.ChannelID)
|
||||
|
||||
if err != nil {
|
||||
fs.log.Error("file stream", zap.Error(err))
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
@ -613,6 +616,7 @@ func (fs *FileService) GetFileStream(c *gin.Context) {
|
|||
if r.Method != "HEAD" {
|
||||
parts, err := getParts(c, client.Tg, file, channelUser)
|
||||
if err != nil {
|
||||
fs.log.Error("file stream", zap.Error(err))
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e02a73d7e96aebd1db9c893b9ce3d5576542d241
|
||||
Subproject commit 377f0bd8c67d35d03ec806a8ab58b0d2bad35a0d
|
Loading…
Reference in a new issue