Commit graph

108 commits

Author SHA1 Message Date
Sagar Vora
a9fd5f5001 fix: dont allow blank content of unsupported type 2022-07-11 14:23:10 +05:30
Sagar Vora
e8623dbc19 fix: simplify condition 2022-07-11 14:10:59 +05:30
Raffael Meyer
bbfdc52e5c
fix: check mimetype if content is present (#17456) 2022-07-11 06:52:23 +00:00
Gavin D'souza
5ec2690160 Merge branch 'develop' into refactor-file 2022-06-01 15:47:55 +05:30
Ritwik Puri
20d73cae24
fix: allow guests/users without desk access to upload text files (#16920)
* fix: allow guests/users without desk access to upload text files

* chore: update error message

Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com>
2022-05-18 17:39:44 +05:30
Gavin D'souza
97e911e069 Merge branch 'develop' of github.com:frappe/frappe into refactor-file 2022-04-13 10:49:26 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
ec6d71e864 chore(handler): Added typing, removed unnecessary assignments 2022-03-28 18:15:45 +05:30
Gavin D'souza
47cf46cd49 Merge branch 'develop' of github.com:frappe/frappe into refactor-file 2022-03-24 21:38:21 +05:30
barredterra
f650408daa refactor: use frappe.parse_json 2022-03-20 18:02:44 +01:00
barredterra
1934340a1b refactor: don't assign variable to itself 2022-03-20 01:46:27 +01:00
Gavin D'souza
59e45a2e2f refactor: File APIs
Restructured and moved most APIs under frappe.core.api.file namespace.
Changed some obvious security gaps (like using get_list instead of
get_all for an endpoint), styled, added type hints and made minor performance
enhancements.

Changes
* download_file API
    * Move API to handler.py
    * Check for permissions via File.is_downloadable instead
* Moved APIs to new namespace: `frappe.core.api.file`
* Backwards compatibility
    * Added APIs to override_whitelisted_methods to maintain existing
      client endpoints
    * Imported APIs to controller's namespace to avoid breaking external
      app usages
2022-03-15 19:39:47 +05:30
Gavin D'souza
aaf50d28ee fix!: Raise 403 if Guest isn't allowed to upload file 2022-03-15 19:39:47 +05:30
Sagar Vora
01f4ba2061 feat: frappe.enqueue and frappe.call for server scripts 2021-12-22 13:21:13 +05:30
Sagar Vora
5df970013e feat: translations in Data Import 2021-12-21 12:05:38 +05:30
Faris Ansari
02759631b4 fix: handle falsy return values in document methods
problem: if a whitelisted document method returns a falsy value like
`[]`, `{}`, `0` then response.message is not set and not returned
in the response.

this change checks if the return value is `None` and falsy values
are returned properly in the response
2021-12-06 15:38:59 +05:30
Sagar Vora
77e0b59525
fix: minor fixes to whitelisted methods (#14569) 2021-11-07 19:13:26 +05:30
barredterra
a5a4f33644 fix: handle JSON content in run_doc_method
(cherry picked from commit d130a91d9c5d9158fb78563f5a20145a356d07f0)
2021-09-28 05:59:14 +00:00
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
mergify[bot]
afd69729de
Merge pull request #13835 from MitulDavid/image-processing
feat: Image cropping and optimization
2021-08-10 05:16:08 +00:00
MitulDavid
ccfe4a857c refactor: Minor changes to doc image upload, UI test 2021-08-09 17:28:57 +05:30
ChillarAnand
703edfed73 fix: Show command and error message when an exception is raised 2021-08-09 15:34:52 +05:30
MitulDavid
a3430ca2a9 feat: Image optimization 2021-08-02 18:23:26 +05:30
barredterra
37dc0b12ef refactor: suggestions from review 2021-06-18 16:23:21 +02:00
Raffael Meyer
7f7e8ac36a
Merge branch 'develop' into google_drive_picker 2021-06-03 15:01:50 +02:00
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Gavin D'souza
e1c69cecca chore: Update usages of inspect getargspec
Deprecated since version 3.0: Use getfullargspec() for an updated API that is usually a drop-in replacement, but also correctly handles function annotations and keyword-only parameters.

ref: https://docs.python.org/3/library/inspect.html#inspect.getargspec
2021-05-05 18:31:26 +05:30
barredterra
5c2a0f4aaf Merge branch 'develop' into google_drive_picker 2021-04-27 12:55:06 +02:00
Revant Nandgaonkar
1d0e72834d fix: remove unused imports 2021-04-19 15:54:16 +05:30
Revant Nandgaonkar
8c74df6cc3 fix: duplicate validate_auth calls 2021-04-19 15:18:15 +05:30
barredterra
6d523c77e3 feat: use nice file name 2021-04-17 17:45:42 +02:00
Suraj Shetty
0a399f56c8
Merge pull request #12743 from surajshetty3416/fix-whitelisted-method-failure 2021-04-02 12:45:33 +05:30
Suraj Shetty
8cfdb3406c
fix: Throw validation error instead 2021-03-31 22:30:29 +05:30
Suraj Shetty
f0075f5b1f fix: Invalid method should not throw 404 error 2021-03-31 17:07:07 +05:30
Sagar Vora
1a9a13e4c2 fix: better code quality for run_doc_method 2021-03-30 13:47:39 +05:30
Sagar Vora
81b65545b7 fix: improved docstring for run_doc_method 2021-03-30 13:37:14 +05:30
Sagar Vora
f1ed50a64d fix: add valid_http_method validation for methods 2021-03-30 13:28:55 +05:30
Sagar Vora
40fa9e277a fix: remove deleted module from imports 2021-03-30 13:16:38 +05:30
Sagar Vora
08d88425d2 fix: sider issues 2021-03-30 13:14:16 +05:30
Sagar Vora
497ea861f4 feat: frappe.whitelist for class methods 2021-03-30 13:07:58 +05:30
Saurabh
a0086db9b6
fix(frappe client): validate http method for frappe.client api (#11228) 2020-09-14 12:30:30 +05:30
Shivam Mishra
1426b2d4b9
refactor: translate error message 2020-04-30 15:56:34 +05:30
Chinmay D. Pai
d7e9ef60b8
fix: add support for more document mimetypes
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-04-16 14:31:25 +05:30
Chinmay D. Pai
23b3f65b3b
fix: limit file upload mimetype if user has no desk access
limits file upload mimetype to jpg, png, and pdf in case the user does
not have desk access, to prevent abuse of the servers as a file storage
system

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-04-16 14:09:59 +05:30
prafful1234
e19b712e23
fix(api): Fix api for user oauth validations (#9676)
* fix(api): Fix api for user oauth validations

* fix: add auth exceptions + format functions

* fix: Moved exceptions and a validation check

* Fix: Reqested changes

Co-authored-by: prafful1234 <prafful@mntechnique.com>
Co-authored-by: Rohan Bansal <rohan@digithinkit.com>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2020-04-11 10:27:00 +05:30
Rucha Mahabal
fa6a29ff37 fix: conflicts 2019-11-13 11:23:30 +05:30
Rushabh Mehta
6d6f575904 feat(server scripts): add server scripts! 2019-10-11 14:16:49 +05:30
Rucha Mahabal
4cfe9eed79 fix: authentication in handler.py 2019-10-11 02:16:31 +05:30
Shivam Mishra
82cb2d0cbb refactor: improved permission logic 2019-09-02 17:33:42 +05:30
Shivam Mishra
652483c225 Merge branch 'upload-guest-fix' of github.com:scmmishra/frappe into upload-guest-fix 2019-09-02 16:33:03 +05:30