[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Tiki API: Update API responses to exclude raw (BLOB) file data
Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69334c187e34e_2aa0bf185e4@gitlab-sidekiq-low-urgency-cpu-bound-v2-78d969c448-sp2w9.mail> |
Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
bd0b3acf by Bruno Kambere at 2025-12-05T21:10:00+00:00
[FIX] Tiki API: Update API responses to exclude raw (BLOB) file data
---
* [FIX] Tiki API: Exclude raw file data from responses and return null
* [FIX] Tiki API: Update API responses to exclude raw (BLOB) file data
See merge request tikiwiki/tiki!8777
- - - - -
4 changed files:
- lib/core/Services/File/Controller.php
- templates/api/docs/paths/galleries/files/entity.yaml
- templates/api/docs/paths/galleries/files/update.yaml
- templates/api/docs/paths/galleries/upload.yaml
Changes:
=====================================
lib/core/Services/File/Controller.php
=====================================
@@ -746,10 +746,17 @@ class Services_File_Controller
throw new Services_Exception_Denied();
}
+ $fileInfo = TikiLib::lib('filegal')->get_file_info($fileId);
+ if (! $fileInfo) {
+ throw new Services_Exception_NotFound(tr('Requested file does not exist'));
+ }
+ // when stored in the database the file contents is here and should not be sent back to the client
+ $fileInfo['data'] = null;
+
return [
'title' => tr('File Info'),
'fileId' => $fileId,
- 'info' => TikiLib::lib('filegal')->get_file_info($fileId)
+ 'info' => $fileInfo
];
}
=====================================
templates/api/docs/paths/galleries/files/entity.yaml
=====================================
@@ -32,8 +32,6 @@ get:
type: integer
filetype:
type: string
- data:
- type: object
user:
type: string
author:
=====================================
templates/api/docs/paths/galleries/files/update.yaml
=====================================
@@ -11,10 +11,13 @@ post:
requestBody:
required: true
content:
- application/x-www-form-urlencoded:
+ multipart/form-data:
schema:
type: object
properties:
+ data:
+ type: file
+ description: file path to upload. If omitted, the current file will remain unchanged.
user:
type: string
description: The user who uploaded the file
@@ -27,23 +30,6 @@ post:
description:
type: string
description: The description of the file
- multipart/form-data:
- schema:
- type: object
- required:
- - data
- properties:
- data:
- type: string
- description: file path
- user:
- type: string
- title:
- type: string
- name:
- type: string
- description:
- type: string
responses:
'200':
description: update file response
@@ -69,7 +55,77 @@ post:
md5sum:
type: string
ticket:
+ type: string
+ syntax:
+ type: string
+ info:
type: object
+ properties:
+ fileId:
+ type: integer
+ galleryId:
+ type: integer
+ name:
+ type: string
+ description:
+ type: string
+ created:
+ type: integer
+ filename:
+ type: string
+ filesize:
+ type: integer
+ filetype:
+ type: string
+ user:
+ type: string
+ author:
+ type: string
+ hits:
+ type: integer
+ maxhits:
+ type: integer
+ lastDownload:
+ type: integer
+ votes:
+ type: integer
+ points:
+ type: string
+ path:
+ type: string
+ nullable: true
+ reference_url:
+ type: string
+ is_reference:
+ type: string
+ hash:
+ type: string
+ search_data:
+ type: string
+ metadata:
+ type: string
+ description: JSON-encoded metadata string
+ lastModif:
+ type: integer
+ lastModifUser:
+ type: string
+ lockedby:
+ type: string
+ comment:
+ type: string
+ archiveId:
+ type: integer
+ deleteAfter:
+ type: integer
+ ocr_state:
+ type: string
+ nullable: true
+ ocr_lang:
+ type: string
+ nullable: true
+ ocr_data:
+ type: string
+ nullable: true
'403':
description: forbidden
content:
=====================================
templates/api/docs/paths/galleries/upload.yaml
=====================================
@@ -56,7 +56,77 @@ post:
md5sum:
type: string
ticket:
+ type: string
+ syntax:
+ type: string
+ info:
type: object
+ properties:
+ fileId:
+ type: integer
+ galleryId:
+ type: integer
+ name:
+ type: string
+ description:
+ type: string
+ created:
+ type: integer
+ filename:
+ type: string
+ filesize:
+ type: integer
+ filetype:
+ type: string
+ user:
+ type: string
+ author:
+ type: string
+ hits:
+ type: integer
+ maxhits:
+ type: integer
+ lastDownload:
+ type: integer
+ votes:
+ type: integer
+ points:
+ type: string
+ path:
+ type: string
+ nullable: true
+ reference_url:
+ type: string
+ is_reference:
+ type: string
+ hash:
+ type: string
+ search_data:
+ type: string
+ metadata:
+ type: string
+ description: JSON-encoded metadata string
+ lastModif:
+ type: integer
+ lastModifUser:
+ type: string
+ lockedby:
+ type: string
+ comment:
+ type: string
+ archiveId:
+ type: integer
+ deleteAfter:
+ type: integer
+ ocr_state:
+ type: string
+ nullable: true
+ ocr_lang:
+ type: string
+ nullable: true
+ ocr_data:
+ type: string
+ nullable: true
'403':
description: forbidden
content:
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/bd0b3acfefe1b77697d22c22150486ee77ebc54a
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/bd0b3acfefe1b77697d22c22150486ee77ebc54a
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs