Commit graph

135 commits

Author SHA1 Message Date
Raffael Meyer
9208b58b6f
refactor: use doc.check_permission (#28317)
* refactor: use `doc.check_permission`

* refactor(delete_doc): check_permission_and_not_submitted
2024-11-22 10:41:24 +01:00
David Arnold
8cfeb156df
devx: add deprecation dumpster (#27887)
* feat: Add deprecation_dumpster.py file

* docs: add jovial and jocose docstring for frappe/deprecation_dumpster.py

* refactor: fill the dumpster with its own kind

* refactor: move to the deprecation dumpster

* chore: color coding class

* fix: only check import error when import errors
2024-10-08 18:56:10 +02:00
David
3a64effe9b
fix: add url to local for custom method to use 2024-10-01 16:21:29 +02:00
Rushabh Mehta
ddee23f5ad fix(ui): sortable sidebar, fixes to breadcrumbs etc 2024-09-06 14:12:36 +05:30
Ankush Menat
16f8d4c107
fix!: drop duplicate uploadfile (#26098)
* fix: deprecate uploadfile

use upload_file

* chore!: Drop deprecated method
2024-04-22 12:45:31 +00:00
Ankush Menat
3c2bf77c81
fix: Avoid permission check on unsaved doc (#26027)
Use case:
- User has "if owner" perm
- Doc isn't created
- We skip doc perm check because doc doesn't exist
- We check if user has write perm to doctype, which isn't available
  because it's only "if owner"

Fix: We can avoid perm check entirely here, files are only re-attached
if doc saves successfully which implies that reference doc was indeed
saved after perm check.
2024-04-18 13:47:39 +05:30
Ankush Menat
3ac30956c9
fix: Check perm for library file before cloning (#25117) 2024-02-27 18:15:20 +00:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
barredterra
09919a3e58 fix: use the correct doc method 2024-01-31 12:55:41 +01:00
Akhil Narang
eb45da3913
feat: Allow usage of print() within safe_exec() (#23084)
* feat(safe_exec): allow usage of `print()`

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* refactor(system_console): update description to mention `print()` instead of `log()`

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* feat: unconditionally add debug logs to response if present

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore(safe_exec): add in a test for running `print()` within safe_exec

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix(safe_exec): ignore warning

RestrictedPython warns us if we call `print()` don't use their `printed` variable

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* feat: store debug logs from scheduled jobs

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix: avoid ignoring warnings, disabled in prod anyway

* chore: remove unnecessary logging

This can be moved to level 2 when required

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-11-20 12:45:41 +05:30
Ankush Menat
66b825c134 chore: deprecate runserverobj 2023-11-01 21:42:05 +05:30
Maharshi Patel
409a3a8105 Merge branch 'develop' into fix-attach-before-doc-save 2023-10-19 11:40:20 +05:30
Ankush Menat
d117e2c08b fix!: Last overriden method should be considered 2023-10-16 18:13:33 +05:30
Ankush Menat
507343f4f6 fix: double response processing 2023-10-16 18:12:53 +05:30
Ankush Menat
c7338f5a83 chore: deprecate form_dict.cmd, globals() 2023-10-16 18:12:53 +05:30
Maharshi Patel
0c9efd3b5a fix: don't overwrite name for library files
name is used in many places and should not be overwritten,
so i have sent name in upload_via_file_browser as library_file_name
which can be used to get existing file.
2023-10-16 12:53:38 +05:30
Maharshi Patel
0439e01ee7 fix: attach file from library
Previously, the attach from library only shared file_url, problem is we
need more information such as is_private.

fix: send name instead of file_url on file uploader and use that in
upload_file handler to get more information about the file then attach
that info to newly created file.
2023-10-16 12:26:39 +05:30
Ankush Menat
cc292d6789 fix!: Last overriden method should be considered
Following same principle of last writer wins everywhere
2023-09-25 16:35:12 +05:30
barredterra
262bda5c91 feat: check write perms on attached to doc(type) 2023-09-21 14:53:45 +02:00
Sagar Vora
023897a35e chore: define ping API only once 2023-08-24 18:05:15 +05:30
Sagar Vora
b395a84d0b
fix!: remove version API (#21786) 2023-07-24 13:01:45 +05:30
Ankush Menat
b66c3d9106
fix: content_type can be None during file upload (#20572)
closes https://github.com/frappe/frappe/issues/20571
2023-04-03 19:49:56 +05:30
Faris Ansari
faae4e7a86
Merge pull request #19433 from netchampfaris/allow-video-files 2022-12-29 16:09:10 +05:30
Faris Ansari
d60acc7cb4 fix: allow video files to be uploaded 2022-12-29 15:40:41 +05:30
Saqib Ansari
296ef1f9bd chore: add methodname to monitor log (#19388) 2022-12-22 14:18:42 +05:30
Gavin D'souza
eb4aa0a1f3 fix(handler): Use signature to fetch doc method structure 2022-12-15 13:47:05 +05:30
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