Problem/Motivation
For certain site configurations, you can end up with errors on the Google Translator UI form (/admin/tmgmt/translators/manage/google_v3). We have sites that are configured with this file setting:
$config['file.settings']['make_unused_managed_files_temporary'] = TRUE;
See the
change record →
for information on that setting.
When your site is configured this way, you end up with the following error message when you attempt to update your GCP credentials JSON:
The file used in the Google API Credentials field may not be referenced.
The issue here is that the module is not registering file usage for the JSON file uploaded, so when make_unused_managed_files_temporary
is set, Drupal wants to downgrade the file to termporary b/c it doesn't see any file usage.
Steps to reproduce
Add this to your settings.php:
$config['file.settings']['make_unused_managed_files_temporary'] = TRUE;
Attempt to upload your GCP credentials JSON at /admin/tmgmt/translators/manage/google_v3
Proposed resolution
Use the file.usage
service to register use of the uploaded GCP credentials JSON file.
Remaining tasks
Patch.
User interface changes
None.
API changes
None.
Data model changes
None.