mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-09 16:49:51 +08:00
update user profile check
This commit is contained in:
parent
b3353893e2
commit
2cf0ad7d01
1 changed files with 5 additions and 4 deletions
|
@ -3,6 +3,7 @@ package services
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -70,10 +71,10 @@ func (us *UserService) GetProfilePhoto(c *gin.Context) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
peer := self.AsInputPeer()
|
peer := self.AsInputPeer()
|
||||||
if self.Photo == nil {
|
photo, ok := self.Photo.AsNotEmpty()
|
||||||
return nil
|
if !ok {
|
||||||
|
return errors.New("profile not found")
|
||||||
}
|
}
|
||||||
photo, _ := self.Photo.AsNotEmpty()
|
|
||||||
location := &tg.InputPeerPhotoFileLocation{Big: false, Peer: peer, PhotoID: photo.PhotoID}
|
location := &tg.InputPeerPhotoFileLocation{Big: false, Peer: peer, PhotoID: photo.PhotoID}
|
||||||
buff, err := iterContent(c, client, location)
|
buff, err := iterContent(c, client, location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -88,7 +89,7 @@ func (us *UserService) GetProfilePhoto(c *gin.Context) {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(c.Writer, err.Error(), http.StatusBadRequest)
|
c.AbortWithError(http.StatusNotFound, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue