MCPcopy Create free account
hub / github.com/53AI/53AIHub / getWPSFile

Function getWPSFile

api/controller/wps.go:203–226  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

201}
202
203func getWPSFile(c *gin.Context) (any, error) {
204 file, wpsErr := getWPSFileCommon(c, true)
205 if wpsErr != nil {
206 return nil, wpsErr
207 }
208
209 fileIDStr := c.Param("file_id")
210 ctx, err := weboffice.ParseContext(c.Request, true)
211 if err != nil {
212 return nil, weboffice.ErrInvalidArguments.WithMessage(err.Error())
213 }
214 wpsFile := &weboffice.GetFileReply{
215 CreateTime: file.CreatedTime / 1000,
216 CreatorId: fmt.Sprintf("%d", file.UserID),
217 ID: fileIDStr,
218 ModifierId: fmt.Sprintf("%d", ctx.UserModel().UserID),
219 ModifyTime: file.UpdatedTime / 1000,
220 Name: resolveWPSVisibleFileName(file),
221 Size: file.UploadFile.Size,
222 Version: int32(file.UpdatedTime / 1000),
223 }
224
225 return wpsFile, nil
226}
227
228func getWPSFileDownload(c *gin.Context) (any, error) {
229 // if c.GetHeader("Referer") != "https://solution.wps.cn" {

Callers

nothing calls this directly

Calls 6

getWPSFileCommonFunction · 0.85
int32Function · 0.85
WithMessageMethod · 0.80
UserModelMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected