2113 Commits

Author SHA1 Message Date
rijkvanzanten
f52da51925 v9.11.0 2022-05-19 13:09:50 -04:00
José Varela
999bb85539 Assets: Fix range requests (#13391)
* Return chunk even if range is greater than filesize

* Allow range.start or range.end to not be defined
Examples:
bytes=-300
bytes=300-
bytes=-300- (negative start)

* Make expression lazy instead of greedy
Fix CodeQL "Polynomial regular expression used on uncontrolled data"

* Improve checks readability

* Show proper range in case of failure

* Fix compare falsy values vs zero values

* replace regex

* Handle range validation in a single place

* Clean validation

* Use range object for exception

* Resolve range undefined check

* Prefer strict equality checks

* Cleanup

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-05-19 17:01:18 +00:00
ian
d51240d03f Fix parsing of time and dates when filtering in SQLite (#13410) 2022-05-19 10:00:20 -04:00
ian
ba3fcb8247 Fix compareValue check for _null and _empty type of operators (#13388) 2022-05-18 13:38:38 -04:00
Jesper
b2d8b2319a GraphQL count aggregation for all fields and * (#11871)
* GraphQL count aggregation for all fields

Fixes #11792

* Rename countRows to countAll

* moved function to new apply-query folder

Co-authored-by: jaycammarano <jay.cammarano@gmail.com>
2022-05-18 15:34:12 +00:00
Bernat Vadell
7e1b946b20 Add support to insensitive case operators (#11737)
* feat: refactor apply-query & implements icontains

* feat: implements icontains in app

* New translations en-US.yaml

* tests: fix returns the filter operators for binary

* implement rest insensitive operators

* fix: proposal to fix #5996 (convert "in" into "exists")

* delete unused imports

* fix: prevent error when operator filter value is null

* fix: apply-query imports

* some tests

* fix: _nstarts_with not applied correctly

* tests: add some filter mathematical tests
2022-05-18 09:58:53 -04:00
Azri Kahar
79ddd35fe0 fix user update without status in payload issue (#13375) 2022-05-18 06:59:53 +00:00
ian
72a19477a7 Fix inconsistent revisions after batch update (#13250)
* Sort keys to ensure order

* Set query limit as the number of keys

* Add query limit only when reading by keys

* Update test

* Check if keys is of array type
2022-05-16 13:10:31 -04:00
Azri Kahar
a8908577dd Prevent changing active status of last admin user (#13309) 2022-05-16 11:21:15 -04:00
Samuele Zolfanelli
8d064fc646 Allow creating big integer auto-incremented primary keys in MySQL and PostgreSQL (#13301) 2022-05-16 11:12:17 -04:00
eikaramba
e063f1fe2a Stalling Sqlite when using cascading foreign contraints (#13307)
* Fix #10462: Stalling Sqlite when using cascading foreign contraints

otherwise the transaction pool runs full of knex

* make linter happy
2022-05-16 10:47:12 -04:00
ian
e004b0d596 Delete field only after foreign key constraints are removed (#13222) 2022-05-11 10:39:18 -04:00
Diego Leme
25dea417b3 Sort schema snapshot (#12907)
* Sort schema snapshot

* Refactor sort deep

* Fix import

* Fix type

* Remove unused de types

* minor tweak

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-05-10 12:17:26 -04:00
Peera Jeawkok
e47502e11f Fix Invalid foreign key when applying schema snapshot (#12198)
* add logic to create parent collection before apply

* recursively create collection

* Recursively delete collection

* cleanup

* fix import

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* fix deconstruction of collections

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* fix deconstruction of collections

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* Fix destructing

* Move type declaration to the top

As requested during code review https://github.com/directus/directus/pull/12198#discussion_r857330627

* remove unnecessary empty array check.

* remove redundant map functions

* replace lodash functions in favor of built-in ones

* tweaks

* organize imports

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Stephan Schmitz <eyecatchup@gmail.com>
2022-05-09 16:49:20 -04:00
Aiden Foxx
ccd5c39301 Display error message on OAuth errors (#13184)
* Display error message on oauth errors, and notify about incorrect provider

* Updated copy

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-05-09 15:14:11 -04:00
Rijk van Zanten
a36c7eabeb Use json parser wrapper function to prevent pollution attacks (#13191) 2022-05-09 14:57:38 -04:00
Rijk van Zanten
acab4eef35 Fix aliases (#13186)
* Fix REST alias usage

* Properly fix aliases
2022-05-09 10:58:45 -04:00
rijkvanzanten
e3a7a7d887 v9.10.0 2022-05-03 13:05:54 -04:00
Azri Kahar
ad46bfef51 Fix graphql schema for m2o fields without permissions to related collection (#13015)
* fix graphql schema for m2o fields

* add e2e tests for graphql m2o & o2m

* remove unused code

* fix mariadb json error

* attempt to fix oracle

* possibly fix graphql m2o queries
2022-05-03 12:51:12 -04:00
tenebrius
62d8224af9 Convert OAuth identifier to string before calling toLowerCase (#13067)
* Convert identifier to string before calling toLowerCase

Fixes [#13066](#https://github.com/directus/directus/issues/13066)

* allow numbers for indentifier in oauth and openid user profile

* typescript fix

* handle case if email is not string

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>

* typescript fix

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-05-03 10:35:47 -04:00
Nicola Krumschmidt
aeb919ba7f Update knex to version 2.0.0 (#13051)
* Update knex to version 2.0.0

Fixes #10842

* Remove unused optional dependencies

* Update sqlite3 to version 5.0.6

* Fix returning primary key when inserting items into database
2022-05-03 10:20:49 -04:00
Josh Soref
0b01923b0d Spelling (#13072) 2022-05-02 13:16:03 -04:00
Rob Lee
b62456fca8 first attempt at nested sorting (#12084)
* first attempt at nested sorting

* pull out addJoin so it can be reused

* Move get-relation-info to file, add tests

* Extract get-column-path, add tests

* Little cleanup

* Prevent the regex from blowing up with malicious input

* Allow sorting on m2o fields in the tabular layout

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-27 15:02:10 -04:00
rijkvanzanten
5d19120cf4 Force share generated perm set to read 2022-04-26 14:34:06 -04:00
Rijk van Zanten
d7d47b4e14 Allow configuring the HSTS header (#13004) 2022-04-25 16:46:55 -04:00
Rijk van Zanten
aae90979fb Allow disabling GraphQL introspection (#13003) 2022-04-25 16:20:32 -04:00
Rijk van Zanten
70c70af4ee Support BOM in CSV import (#12993)
Fixes #12970
2022-04-25 10:39:19 -04:00
gkielwasser
625b1dbc7e Store original error code in extensions (#8034)
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-22 17:32:39 -04:00
rijkvanzanten
18407ad7c3 Add missing " 2022-04-22 17:10:07 -04:00
rijkvanzanten
ed780aceba v9.9.1 2022-04-22 12:21:24 -04:00
Azri Kahar
3965a5e6dd prevent fields without permissions from appearing (#12949) 2022-04-22 11:56:21 -04:00
Azri Kahar
90b5883f49 fix api for non existent fields & collections (#12952) 2022-04-22 10:49:03 -04:00
Azri Kahar
4438909186 Fix readSingleItems response from array to object (#12922) 2022-04-21 08:21:35 -04:00
Rijk van Zanten
78a3895f75 Give config file higher priority than existing env (#12900)
Fixes #12884
2022-04-20 16:33:26 -04:00
Rijk van Zanten
d652a12008 Ignore non-alias fields that only exist in directus_fields (#12860)
* Ignore non-alias fields that only exist in directus_fields

Fixes #12857

* Organize imports
2022-04-19 14:44:32 -04:00
Azri Kahar
08e57c2901 only set default value when exists for singleton (#12852) 2022-04-19 11:18:09 -04:00
Azri Kahar
098dc4cc70 fix directus_user mutation with role (#12849) 2022-04-19 10:32:08 -04:00
Azri Kahar
460f0ba003 Fix alias (#12826)
* fix alias

* minor clean up

* fix graphql nested junction aliases
2022-04-19 10:19:49 -04:00
Rijk van Zanten
986bd51759 Don't save directus_revisions row for empty delta (#12839)
Fixes #12838
2022-04-18 22:54:19 +00:00
Rijk van Zanten
7dd8e8a6a9 Support jsonb in count() (#12835)
* Support jsonb in count()

Fixes #12779

* Flip check

The expected path is json rather than jsonb, so it feels like the safer default
2022-04-18 15:16:57 -04:00
Rijk van Zanten
982a7836f2 Scope not null in subquery (#12833)
Fixes #12803
2022-04-18 13:21:29 -04:00
Rijk van Zanten
74fbba5c3b Fix casting of duplication fields (#12824)
Fixes #12555
2022-04-18 10:39:41 -04:00
Rijk van Zanten
d8b81f07c7 Throw 400 on file upload with missing filename (#12785)
Fixes #8101
2022-04-15 17:36:42 -04:00
rijkvanzanten
fb252ca4ce v9.9.0 2022-04-15 14:26:54 -04:00
Azri Kahar
953eb99eb3 Fix schema apply for changes in field meta options & display_options (#12712)
* Fix schema apply for changes in field meta options

* take display_options into account

* check changes in meta in general
2022-04-15 13:27:47 -04:00
Nitwel
3e1fce8968 Relational Interfaces Rework 🐰🕳️ (#12082)
* add basic util function for later use

* sketch up useRelationMultiple implementation

* update relation util and start reworking relational interfaces

* support filter in m2o

* start working on useRelationMultiple

* continue working on relational foundation

* finish basic use-relation-multiple composable

* get o2m pretty close to being finished

* finish up list-o2m

* replace old interfaces

* copy existing interface

* rewrite vue file

* highlight deleted items

* use Search instead of Get

* support selection on m2m

* finish up m2m

* replace old files

* update files interface

* fix permission checks

* fix styling

* add sketches to explain relations

* rewrite m2a interface

* add usage hint to use-relation-multiple

* update file interface to use new composable

* update file-image interface

* fix image not being shown

* revert names

* fix selection of existing items

* fix loading selected items

* in between commit

* update translations interface

* try using composable recursive

* try linear approach on value modeling

* finish rewriting list-o2m-tree-view interface

* revert api changes

* fix sorting for list-o2m-tree-view

* fix selected items in created array

* Add direct download option to files interface

* Fix linter warnings

* Weird that it's being difficult, but ok

* Cast existingItemCount to number at all times

* fix page gets set below 1

* align pagination to the right

* highlight deselecting row

* show min 1 skeleton loader

* only filter selected when item exists

* fix working on new items

* Fix linter warning

* fix deselecting selected items

* show different icon depending if icon is local

* add changes from #12611

* Add _some vs _none support to o2m

* finish filtering out selected items

* Use get instead of search request

* fix save and stay

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>

* fix adding items to m2o

* Fix linter warning

* Handle no-type better

* Clean up axios usage

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-04-14 22:57:17 +02:00
keesvanbemmel
d11c59462f Adds x-directus-cache response header with HIT value (#12732)
* Adds x-directus-cache response header with HIT value

* Added ENV var for cache header and MISS, UNCACHEABLE

* Rename CACHE_HEADER_KEY -> CACHE_STATUS_HEADER

Tad opinionated, but I feel like it describes the functionality slightly better

* Return miss consistently

Uncacheable doesn't quite describe what's happening. The user actively requests the cache to be skipped, which should result in an expected miss. The value isn't un-cacheable, the cache is skipped on purpose

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-14 13:42:10 -04:00
Aiden Foxx
fd668647c1 Added default role support to LDAP and allow optional role syncing (#12767)
* Added default role support to LDAP and allow optional role syncing

* Add minimal docs

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-14 11:27:17 -04:00
Nick Olszanski
360d5b64f5 add Last-Modified header to /assets/* responses (#12231)
* add `Last-Modified` header to `/assets/*` responses

only affects assets with a valid `modified_on` DB field

* update docs about `Last-Modified`

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-13 16:46:34 -04:00
Azri Kahar
513cb7b824 Fix schema apply of UUIDs from SQLite onto other databases (#12723)
* Fix schema apply for UUIDs from SQLite

* simplify the merge a little bit
2022-04-13 15:32:02 -04:00