Repository navigation
fix: automated upload works for non-English sources and matches the manual upload; webhook dialog URL - #133
Merged
Merged
Conversation
…l upload The create/update upload hook and the delete deprecation hook built their keys differently from the manual upload: - blocks fields were not projected to their text leaves, so saving an entry uploaded the raw AST (`type`, `bold`, `url`, … as source strings), - `getPickPaths` instead of `getPickPathsWithComponents` dropped every dynamic zone field, so saving never uploaded dynamic zone content, - entries excluded from translation were uploaded anyway. Both paths now use one `getUploadKeysForEntries`, and the hooks skip excluded entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dialog suggested `<server url>/api/localazy/public/transfer/download`, but the plugin's public route is `/localazy/public/transfer/download` (no `/api` prefix). Strapi answers the `/api` path with 405, so a webhook saved with the suggested URL never reached the plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hooks looked for the default locale with `locales.find()` + `isDefault`, but Strapi's i18n service returns plain locale rows without `isDefault` (only its admin API adds it). The lookup always fell back to the plugin default `en`, so for any project with another source language every automated upload and deprecation stopped with "Source locales do not match". Use `getDefaultLocaleCode()`, as the manual upload does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
honzabubenik
approved these changes
Nov 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the automation loop: save in Strapi → automated upload → Localazy → webhook → download. Found while setting it up on the same site as #131 (Czech source, English via Localazy AI). Three independent bugs stopped or corrupted it.
1. Automated upload never ran when the source language isn't English
The hooks looked up the default locale with
locales.find()+isDefault. Strapi's i18n service returns plain locale rows withoutisDefault; only its admin API adds it. So the lookup always fell back to the plugin defaulten, and for any other source language every automated upload/deprecation stopped withSource locales do not match; the operation won't proceed. It now usesgetDefaultLocaleCode(), as the manual upload does.2. Automated upload/deprecation built different keys than the manual upload
projectBlocksFields)story[0].type=paragraph,…children[1].bold=true,…url=https://…uploaded as source stringsgetPickPathsWithComponents)getPickPathsnever matches dynamic zone keysThe new
getUploadKeysForEntriesbuilds the keys for both paths. The hooks also skip excluded entries.3. The webhook setup dialog suggested a dead URL
It pre-filled
<server url>/api/localazy/public/transfer/download, but the plugin's public route is/localazy/public/transfer/download. Strapi answers the/apipath with 405 (as it does for any unknown POST under/api), so a webhook saved with the suggestion never reached the plugin.Tests
get-picked-flatten-keys-for-hook-entry.test.tsruns the real hook helper (plugin services and Strapi mocked as Strapi returns them: locale rows withoutisDefault) for create, update and delete. It asserts the keys equal the manual upload's: blocks text leaves only, dynamic zone and component fields included, notype/bold/urlkeys. Excluded entries are skipped. All 4 cases fail on 1.7.1.transfer-round-trip.test.tsnow uploads throughgetUploadKeysForEntries.test:ts:back,test:ts:front,lint,format:check,buildandverifypass locally.Verified on a real Strapi 5.50 instance
Local mirror of the site, connected to its real Localazy project. Automated upload on create/update and deprecation on delete were enabled, and the webhook was registered through the dialog behind a temporary tunnel.
Source locales do not matchand uploaded nothing.project_publishedwebhooks reached the plugin through the URL the dialog suggested, passed verification, and started incremental English-only downloads./en/s/<slug>.delete hook result: {"success":true}), and its keys disappeared from the active key list in Localazy.🤖 Generated with Claude Code