Sagar Vora
f4035e0044
fix: explicitly specify inline disposition for PDFs
2026-01-22 17:33:44 +05:30
ljain112
4a9af04f94
fix: update Content-Disposition header for binary as attachment
2026-01-22 17:30:43 +05:30
Akhil Narang
c14e9d5d20
fix(response): set content-disposition header correctly again
...
Broke in ee2c4c20ce
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-12 11:49:35 +05:30
Ankush Menat
dc3e598be8
fix: Always show traceback on dev server ( #35263 )
2025-12-16 07:13:28 +00:00
Charles-Henri Decultot
7b0555b4ae
fix: Do not show debug log also for v2 API
2025-09-26 15:51:27 +02:00
Charles-Henri Decultot
1ae276d441
fix: do not show debug message when traceback is disallowed
2025-09-26 13:15:01 +02:00
Akhil Narang
b8afe4b303
fix: set content-type for the responses not handled by werkzeug
...
I had suggested removing this code, didn't realise it applied to the whole function and not just the else block
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-09-19 15:39:28 +05:30
Saqib Ansari
ec0a864d35
refactor: simplify send_file parameters
2025-09-17 13:39:45 +05:30
Saqib Ansari
ee2c4c20ce
feat: use werkzeug send_file to allow range requests
2025-09-03 11:30:19 +05:30
Sagar Vora
2e5c8bea03
feat: frappe.utils.orjson_dumps
2025-06-26 17:37:51 +05:30
Sagar Vora
b857a4099a
perf: use orjson for faster request processing
2025-06-26 17:37:51 +05:30
Faris Ansari
56c3a55665
fix: print traceback instead of errprint
2025-06-18 15:56:11 +05:30
Faris Ansari
fc86f9737b
fix: print error traceback in api/v2
2025-06-18 15:51:13 +05:30
Ankush Menat
e4bc7f361b
Revert: DocRef ( #32866 )
...
- Hardly used anywhere
- Too many hardcoded `__value__` calls without which it's not usable.
- Another type to worry about
2025-06-10 05:20:56 +00:00
Sagar Vora
210709ad14
fix: revert to simpler LocalProxy override
2025-03-22 10:26:09 +05:30
Sagar Vora
2a2700970d
perf: pre-create UnionType objects
2025-03-20 21:34:07 +05:30
Sagar Vora
1c73999821
fix: recognise frappe's LocalProxy when serializing
2025-03-20 19:01:30 +05:30
Ankush Menat
e4b0d11b19
fix: only show tracebacks to system users ( #31629 )
...
Website users by design are supposed to be "less trusted", so don't show
tracebacks to them.
2025-03-13 14:48:20 +05:30
Sagar Vora
4f374ee1c9
fix: ignore disable_traceback if _dev_server is True
2025-02-19 12:59:14 +05:30
Sagar Vora
f4062b4d7a
fix: ensure consistent error in response
2025-02-19 12:10:59 +05:30
Ankush Menat
320798d390
perf: add cache-control headers on private files ( #29221 )
...
* perf: add cache-control headers on private files
- Client(browser) side cache
- 1 hr expiry
- 1 day revalidation
- etagged by nginx in default config (so no data transfer on expiry still)
In conjunction with https://github.com/frappe/agent/pull/157
* fix: Don't override existing headers
2025-01-17 18:51:34 +05:30
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
David Arnold
a4014ab1c4
fix(json-serialization): prioritize explicit __json__ before iterable ( #28597 )
2024-11-27 13:11:53 +00:00
David Arnold
2abba7b51b
fix: don't force values into the string type ( #28185 )
2024-10-19 19:00:25 +00:00
David Arnold
75b58802ad
fix(docref): json serialization ( #28182 )
2024-10-19 14:11:51 +00:00
David
7d5b63a267
fix: improve serializer
2024-09-12 21:06:10 +02:00
Akhil Narang
3f524be635
fix(json_handler): handle uuid.UUID
...
Resolves #25242
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-13 17:27:30 +05:30
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
718b5b8bee
fix: Private images in PDFs from background jobs ( #24980 )
...
* refactor: Private images rendering in PDFs
Private images currently render fine if PDF is generated during a
request as we pass the cookiejar to WKHTML.
Background jobs however fail completeley because they can't retrieve
private images without cookiejar.
This PR converts all image types to base64 encoded sources in HTML
itself, so wkhtmltopdf doesn't have to a fire a request.
* test: private images in pdf
2024-02-21 10:38:02 +00:00
Akhil Narang
26ae0f3460
fix: ruff fixes
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
de9ac89748
style: re-format with ruff
2024-02-05 18:53:33 +05:30
Ankush Menat
dedadbb0d9
perf: optional faster perm check for files
2024-01-31 10:49:18 +05:30
Ankush Menat
d838da51dd
fix: short circuit private files perm check
...
For guest users there's no point in checking permissions, they'll eventually fail... instead just fail immediately.
2024-01-30 20:31:28 +05:30
Ankush Menat
ee6743c26b
fix: avoid mutating list while iterating over it ( #24438 )
2024-01-18 05:44:30 +00:00
Akhil Narang
5c90e151ab
Merge pull request #24246 from akhilnarang/fix-file-download
...
fix(response): fixup non-ASCII character filenames
2024-01-11 16:15:23 +05:30
Ankush Menat
0a38fb0813
fix: skip exc without exc id
2024-01-11 13:09:43 +05:30
Akhil Narang
e622198bab
fix(response): fixup non-ASCII character filenames
...
This was previously only handled for binary files
Werkzeug crashes otherwise:
17:54:40 web.1 | Traceback (most recent call last):
17:54:40 web.1 | File "/home/akhil/frappe/frappe-bench/env/lib/python3.11/site-packages/werkzeug/serving.py", line 362, in run_wsgi
17:54:40 web.1 | execute(self.server.app)
17:54:40 web.1 | File "/home/akhil/frappe/frappe-bench/env/lib/python3.11/site-packages/werkzeug/serving.py", line 326, in execute
17:54:40 web.1 | write(data)
17:54:40 web.1 | File "/home/akhil/frappe/frappe-bench/env/lib/python3.11/site-packages/werkzeug/serving.py", line 266, in write
17:54:40 web.1 | self.send_header(key, value)
17:54:40 web.1 | File "/usr/lib/python3.11/http/server.py", line 526, in send_header
17:54:40 web.1 | ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
17:54:40 web.1 | UnicodeEncodeError: 'latin-1' codec can't encode characters in position 43-52: ordinal not in range(256)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-10 18:44:51 +05:30
Revant Nandgaonkar
37803a00d4
fix: strip exc from json response if traceback not allowed ( #23989 )
...
* fix: strip exc from json response if traceback not allowed
* fix: use pop instead of del to avoid key error
* fix: Avoid showing exc when traceback is disabled
---------
Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-12-28 10:45:06 +05:30
Shariq Ansari
4c9dea8d62
fix: use encoded filename for arabic (latin) language while exporting
2023-12-07 12:46:27 +05:30
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
e2714c3e1c
feat: v2 error and debug log structure
2023-10-16 18:13:50 +05:30
Ankush Menat
018ed845bd
refactor: defer unnecessary json-dumping of messages
...
Also avoid accessing locals where interface is present like for popping last message.
2023-10-16 18:13:50 +05:30
Ankush Menat
411819ef81
feat: v2 for message response strucutre
2023-10-16 18:13:50 +05:30
Ankush Menat
3cc2ca8fc7
test: old API messages
2023-10-16 18:13:50 +05:30
Ankush Menat
909457de3d
fix: PDF and raw response ( #22402 )
2023-09-13 16:42:49 +00:00
Ankush Menat
0eb509aac3
refactor: Correct Content-Disposition headers ( #22383 )
2023-09-13 12:57:14 +05:30
ViralKansodiya
b0bb9a55d5
fix: error while export a doctype report in excel ( #22376 )
...
* fix: error while export a doctype report in excel
* Update frappe/utils/response.py
---------
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2023-09-13 12:13:31 +05:30
barredterra
b553ed98d8
refactor: inline immediately returned variable
...
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
Ankush Menat
6e94cd2eb9
fix: Guess most likely exception source ( #21827 )
2023-07-27 17:30:04 +05:30
Sagar Vora
5f0707c856
chore: remove unused variable
2023-07-23 15:10:37 +05:30