Commit graph

37056 commits

Author SHA1 Message Date
Gavin D'souza
f23298fc16 chore: Drop unmaintained file
To check out the up-to-date version of hooks.md, see https://frappeframework.com/docs/v13/user/en/python-api/hooks
2022-03-24 21:37:20 +05:30
Gavin D'souza
cec4c92a29 fix(test): Update file tests for the new API changes 2022-03-24 21:31:28 +05:30
Gavin D'souza
654f744e63 fix(File): Misc fixes
* Move checks into common methods
* Refactor to use latest APIs
* Remove seemingly unnecessary code
* Fix previously undhanled use cases
2022-03-24 21:27:21 +05:30
Gavin D'souza
e6192f2232 refactor(File): Use _content attribute instead of overwriting content 2022-03-24 21:23:35 +05:30
Gavin D'souza
e180257510 fix: Handle File on rollback
Delete, Move or Restore files in the filesystem by setting Document
flags in the on_rollback method
2022-03-24 21:19:58 +05:30
Gavin D'souza
d53b05fcb7 refactor(file): File.is_remote_file instead of startswith http 2022-03-24 21:17:43 +05:30
Gavin D'souza
8ec96dab69 fix: Misc fixes
* Set default Falsy value for content
* Extend Frappe exceptions into file's
2022-03-24 21:12:58 +05:30
Gavin D'souza
60ef536393 fix: Strip HTML tags in traceback shown in the terminal 2022-03-24 19:31:02 +05:30
Gavin D'souza
f8f0402afd fix: Skip handling is_private updates for remote files 2022-03-23 16:59:37 +05:30
Gavin D'souza
4caf7bcd12 fix: save_file only for non folder records 2022-03-21 17:31:56 +05:30
Gavin D'souza
287543311c fix: Remove duplicate rollback observers and maintain order 2022-03-21 16:28:57 +05:30
Gavin D'souza
e1851f26d0 fix: os.fsync to flush internal buffers to disk
ref: https://docs.python.org/3/library/os.html#os.fsync
2022-03-21 16:27:08 +05:30
Gavin D'souza
e19ced5221 refactor: File.handle_is_private_changed
* Make file renaming atomic
* Add rollback observer to maintain filesystem consistency
* Simplify logic
2022-03-21 16:26:39 +05:30
Gavin D'souza
3d25f6939e refactor: File.optimize_file
* Generalize file content reverting on rollback
* Overwrite current file instead of adding a dangling new file
* Use File.save_file instead of additional "custom" logic
* Set File.content on calling get_content method
2022-03-21 15:50:11 +05:30
Gavin D'souza
5f66f610c3 fix: File.file_url as empty string as fallback 2022-03-16 17:47:35 +05:30
Gavin D'souza
3110c42b80 fix(utils): URLs to return True via is_safe_path checks 2022-03-15 19:39:47 +05:30
Gavin D'souza
b87f31a94e refactor: File controller
* Simplify object lifecycle flows
* Re-organize and separate distinct actions / APIs
* Style black-ish
* Simplify logic in methods "touched"
2022-03-15 19:39:47 +05:30
Gavin D'souza
c6bad81f24 fix: Use new direct import paths
The old paths worked too, but it's just better to use the new paths and
not go in circles ;)
2022-03-15 19:39:47 +05:30
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
Gavin D'souza
6ae3b65425 chore: Use standard APIs 2022-03-15 19:39:47 +05:30
Gavin D'souza
af673f0082 fix: Generate non-conflicting names in File.save_file
Other fix:
* Don't set File.file_name (too) different from File.file_url
2022-03-15 19:39:47 +05:30
Gavin D'souza
48c448160d refactor: Restructure File module
* Separate out utils, exceptions & core / maintain import paths [except
  API endpoints]
* Add type hints
* Simplify logic
2022-03-15 19:39:47 +05:30
Gavin D'souza
9b54e3d0c0 fix: Disallow sites to have file access beyond site folder 2022-03-15 19:39:47 +05:30
mergify[bot]
2b50525a5e
Merge pull request #16243 from shariquerik/number-card-filter-fix
fix: Number Card to support child table doctype for filters
2022-03-15 10:32:30 +00:00
Suraj Shetty
e0def6fdd1 style: Remove unnecessary indentation 2022-03-15 15:51:09 +05:30
Ankush Menat
5f08c9962b fix(ux)!: when error messages are present supress non-error messages 2022-03-15 15:51:09 +05:30
Suraj Shetty
10b6e1902f
Merge pull request #16283 from nextchamp-saqib/fix-delete-message 2022-03-15 15:38:47 +05:30
Saqib Ansari
da080a4091
Merge pull request #16271 from pateljannat/web-form-link-title-doctype-issue
fix: web form link title doctype issue
2022-03-15 15:10:08 +05:30
mergify[bot]
c3e350f2c6
chore: typo mistake (#16275) (#16285)
(cherry picked from commit e997d82da3d5fa74f90fdd878bb0bd8a80bbbc06)

Co-authored-by: Bhavesh Maheshwari <34086262+bhavesh95863@users.noreply.github.com>
2022-03-15 15:02:44 +05:30
Saqib Ansari
d3464f7c11 chore: improve bulk deletion message 2022-03-15 14:28:54 +05:30
Ankush Menat
b2e115513f
Merge pull request #16280 from ankush/docinfo2x
fix: dont return docinfo as `message`
2022-03-15 13:45:21 +05:30
Suraj Shetty
23d7b98317
Merge pull request #16276 from surajshetty3416/fix-build-system 2022-03-15 12:51:08 +05:30
Ankush Menat
db0925d446 fix: dont return docinfo as message
The return was added for testability but it also becomes part of
response so response size doubles. :)
2022-03-15 12:46:36 +05:30
Saqib Ansari
82c0b5b1d9
Merge pull request #16238 from nextchamp-saqib/webform-link-title
feat: show link titles in web form link fields
2022-03-15 12:20:21 +05:30
Shridhar Patil
89f109a197
fix: postgres support for system console processlist (#16212)
* fix: postgres support for system console processlist

* fix: removed logs

* fix: handle dbtype from backend

* fix: use frappe.db.multiselect to run database specific query
2022-03-15 11:55:05 +05:30
Suraj Shetty
ccb4475411 build: Pass watchFiles list to auto trigger rebuild process on template change 2022-03-15 09:29:54 +05:30
Suraj Shetty
24f3123552 build: Use @frappe/esbuild-plugin-postcss2 to auto-trigger rebuild on scss file changes 2022-03-15 09:28:30 +05:30
Jannat Patel
55eb8eed1a fix: calling function directly from boot file 2022-03-15 09:03:37 +05:30
Saqib Ansari
e6f1fbc4f1 refactor: show title only if show_title_field_in_link is enabled 2022-03-14 18:44:38 +05:30
Jannat Patel
825e2d0537 fix: web form link title doctype issue 2022-03-14 18:33:29 +05:30
mergify[bot]
6a45846010
Merge pull request #16199 from resilient-tech/perf-listfactory
perf: remove duplicate call to `ListView.show`
2022-03-14 11:01:27 +00:00
Ankush Menat
b16c8efa30
Merge pull request #16256 from ankush/is_async_commit
fix!: run synchronous background jobs directly in production
2022-03-14 15:57:17 +05:30
Sagar Vora
be1b503958 fix: create before_show method 2022-03-14 15:49:57 +05:30
Sagar Vora
b3035ac20f perf: remove duplicate call to ListView.show 2022-03-14 15:49:57 +05:30
Ankush Menat
23b70df784 fix!: deprecate is_async=False usage outside of tests 2022-03-14 14:27:59 +05:30
Ankush Menat
b5cf4a15c0
Merge pull request #16255 from marination/set-column-display-contradiction
fix: `set_column_disp` contradicts arguments
2022-03-14 11:39:19 +05:30
Marica
57abf9e06b
Merge branch 'develop' into set-column-display-contradiction 2022-03-11 15:44:04 +05:30
Rushabh Mehta
7ace873c3a
Merge pull request #16211 from nikochiko/notifications-hasrole
fix: use parent_doctype=... while fetching users from Has Role table
2022-03-11 15:28:47 +05:30
marination
7723164c05 fix: set_column_display contradicts arguments
- `show` should set `hidden` as 0, but does the opposite. This is fixed.
- Use `Array.isArray()` instead of deprecated usage
2022-03-11 14:35:38 +05:30