Commit Graph

15 Commits

Author SHA1 Message Date
Ophir LOJKINE 99ad2685a0 Add optional mode argument to persist_uploaded_file (#1241)
* Add optional mode argument to persist_uploaded_file

This change adds an optional `mode` argument to the `persist_uploaded_file` function, allowing users to specify the Unix file permissions in octal notation when saving uploaded files.

- Updated `sqlpage.persist_uploaded_file` signature to include `mode`.
- Implemented permission setting logic using `std::os::unix::fs::PermissionsExt` (on Unix platforms).
- Default permission is set to "600" (octal `0o600`).
- Added documentation for the new parameter in `examples/official-site/sqlpage/migrations/39_persist_uploaded_file.sql`, including an explanation of octal notation and a link to Wikipedia.
- Added a unit test `test_set_file_mode` to verify the permission setting logic.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

* Address PR feedback: Add integrated test for persist_uploaded_file mode

- Removed unit test from `functions.rs` and added an integrated test in `tests/uploads/mod.rs`.
- Created `tests/uploads/persist_with_mode.sql` for the integrated test.
- Refactored `set_file_mode` to use `#[cfg(unix)]` and `#[cfg(not(unix))]` on the entire function.
- Replied to PR comments.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

* Fix Windows CI: Normalize paths and improve tests

- Normalized `persist_uploaded_file` return path to use forward slashes for URL compatibility.
- Updated `test_persist_uploaded_file_mode` to handle platform-specific path separators.
- Fixed clippy warning `expect_fun_call` in tests.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

* Address PR feedback: Assert file contents and ignore test uploads

- Added assertion to verify persisted file contents in `test_persist_uploaded_file_mode`.
- Removed accidental test file from git and added `tests_uploads/` to `.gitignore`.
- Replied to PR comments.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

* Address PR feedback: Revert breaking change to return value

- Reverted normalization of `persist_uploaded_file` return value to avoid a breaking change.
- Reverted corresponding test changes that relied on normalized paths.
- Replied to PR comments.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

* Address PR feedback: Query results as JSON in integrated test

- Updated `test_persist_uploaded_file_mode` to directy request and verify JSON results.
- Replied to PR comments.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

* Fix Windows CI: Robust path handling in tests

- Improved integrated test to correctly request JSON results.
- Added platform-specific path normalization when verifying files on disk.
- Ensured `persist_uploaded_file` return value remains OS-specific to avoid breaking changes.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

* Address PR feedback: Delete leftover test file

- Deleted accidental leftover test file `tests_uploads/2026-03-13_15h47m26s_6JaXODDK.txt`.
- Replied to PR comments.

Co-authored-by: lovasoa <552629+lovasoa@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-03-13 19:57:38 +01:00
olivierauverlot 17d892584f Adding an alias named contents to the html property of the shell-empty component (#1122)
* Adding an alias named contents to the html property of the shell-empty component

* Changes for the shell-empty documentation

* improve shell comoonent description

* shell-empty docs clarification

---------

Co-authored-by: Olivier Auverlot <olivier.auverlot@icloud.com>
Co-authored-by: lovasoa <contact@ophir.dev>
2025-11-22 23:46:52 +01:00
lovasoa 63f1ff5e6f fix apexcharts bug
See https://github.com/sqlpage/SQLPage/issues/733
2024-12-10 14:25:34 +01:00
lovasoa 5e4c48df7a ignore xbed.sql 2024-11-13 11:49:00 +01:00
lovasoa 741f479cd3 add package json 2024-11-11 19:41:40 +01:00
Ophir LOJKINE 841ea7e3ec Merge branch 'main' into better_sql_functions 2024-05-09 11:06:49 +02:00
lovasoa 783054032d add detailed explanation in the todo application example 2024-05-08 13:26:40 +02:00
lovasoa 526b6e0fc6 implement sqlpage.cookie and sqlpage.header with the new function system 2024-05-06 22:33:15 +02:00
Ophir LOJKINE 8216313fc9 http/2 and automatic https (#140)
* better docs for multi-select

* wip

* fix bug in corporate conundrum demo

* update dependencies

* Fix bug with variable assignment

fixes #138

* Files (#139)

* document future file functions

* make forms multipart when they contain a file field

* extract http request data reading logic

* start work on file upload

* multipart post data parsing

* millisecond precision in logs

* implement customizable upload file size limits

* wip: add file handling functions

* file handling pseudo-functions

* clippy

* fmt

* Add file upload functionality to changelog

* fix example

* update datetime parsing

* add support for samesite cookies and document cookie expiration

* add support for https

* clippy

* ignore certs

* revert changes to default config

* changelog
2023-11-25 12:55:21 +01:00
lovasoa d1c49896df update gitignore 2023-11-19 21:43:47 +01:00
lovasoa 67b5a660ad ignor profiling files 2023-06-04 12:46:22 +02:00
lovasoa 481066c0fa gitignore idea folder 2023-01-02 21:02:03 +01:00
lovasoa 20cf4d7b05 wiser DATABASE_URL defaults 2022-09-06 14:44:50 +02:00
lovasoa 9074ca3e9d add dockerfile 2022-08-29 19:19:49 +02:00
lovasoa 3109ef88f5 Initial code 2022-08-01 01:51:36 +02:00