- Issue created by @bircher
- Merge request !2Issue #3525219 by bircher: SqliteConfigForm::validateForm does not correctly test real paths → (Merged) created by bircher
- 🇹🇼Taiwan jimyhuang
Thanks, I merged the pull request and tested on my own site.
As part of the form validation the directory to host the sqlite VDB is made sure not to be publicly accessible. This is great, but it does so testing if a fake db called verify-downloadable.sqlite.sql
is accessible.
The problematic part is the call to \Drupal::service('file_system')->realpath($test_db_path)
because at that point $test_db_path
contains the filename but the database has not been created. for normal paths without a stream-wrapper (like public://
or private://
) this falls back to realpath.
But that returns false for files that don't exist, so then \Drupal\ai_vdb_provider_sqlite\Form\SqliteConfigForm::isFilePubliclyAccessible
gets called with FALSE
. But a quirk in php makes it so that if you pass false to realpath you get the current directory and then of course that matches the drupal root, and so the http client checks for a 200 response on the drupal site url and unsurprisingly finds that to be 200 and the form validation fails.
fix the logic
patch
none
none
none
Active
1.0
Code
Thanks, I merged the pull request and tested on my own site.