Skip to content

Add multi-upload and ordered gallery support - #124

Open
RandyCupic wants to merge 103 commits into
4.0from
multiupload
Open

RandyCupic wants to merge 103 commits into
4.0from
multiupload

Conversation

@RandyCupic

@RandyCupic RandyCupic commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Replaces #122, rebased onto 4.0 (the branch was renamed from 3.0-multiupload to multiupload, which closed #122).

Lets a remote media form field hold several resources. Editors can select or upload several resources at once, reorder them, and edit alt text, caption, tags and crops per item. The field data is always an ordered collection of RemoteResourceLocation objects; upload_limit only limits how many items the field accepts.

  • One form type, RemoteMediaType, with a new upload_limit option (null for unlimited, the default, or an integer >= 1). Its data is always an ArrayCollection<int, RemoteResourceLocation>, also with 'upload_limit' => 1 (0 or 1 items), so changing the limit never changes the entity mapping or the stored data. A required field uses Count(min: 1), because NotBlank and NotNull accept an empty collection.
  • The whole selection is submitted as one JSON field, collectionPayload:
    • the form theme renders it with the current value, and a missing payload leaves the field as it is; only an explicit [] clears it. Once the widget is loaded it disables the rendered input, so the field is posted once;
    • entry fields are type-checked, so a malformed payload makes the form invalid instead of a 500;
    • a repeated locationId is kept once, a new entry which repeats a resource of the field is ignored, and location ids that don't belong to the edited value are ignored;
    • over the limit the form is invalid, with a translatable message that says how many to remove (validators domain, en/hr/no), shown at the field (error_bubbling is false);
    • a field without upload_limit looks up at most 100 resources that aren't stored locally per submission (RemoteMediaCollectionTransformer::MAX_REMOTE_LOOKUPS), each of them is a Cloudinary call;
    • after an invalid submit the widget shows what was submitted (order, new items, crops), not the stored value. It uses only resources stored locally, so showing it never calls Cloudinary.
  • Each item shows the alt text and caption stored in Cloudinary and the location overrides (altTextOverride, captionOverride) from JGLWEB-1835 add local alt text and caption overrides #128 next to each other, the same as the CKEditor plugin. Both are carried through the payload, with a loaded snapshot, so only changed values are written. A change of the Cloudinary values or the tags updates the resource in Cloudinary through RemoteResourceService::handleRemoteUpdate(), as before. Fields of one page which show the same resource share its cloud alt text, caption and tags.
  • A field without resources is empty for Symfony (isEmpty()), also with the [] payload, so an optional embedded form whose fields are all empty doesn't get an object created from its empty_data.
  • Order is stored in a new nullable position column on ngrm_remote_resource_location (migration Version040000). The form sets it on submit and sorts by it; entities add #[ORM\OrderBy(['position' => 'ASC'])].
  • Upload panel:
    • drag and drop, per-file name, folder, visibility and overwrite, retry for failed uploads;
    • starts in parent_folder, shows a fixed folder read-only on every row;
    • with limit 1 an upload replaces the current item and keeps its watermark;
    • row uploads respect the limit, the same file can't be queued twice, and dropping several files on a single field says that only one is taken. Empty file names are rejected, and so are a folder and file name longer than 240 characters together. They become the Cloudinary public ID, which has at most 255 characters. The panel refuses such a file before uploading, and the endpoint with a 400;
    • removing a file which is uploading cancels its upload;
    • per-file error handling, an idle timeout of 3 minutes without progress, up to 30 minutes of waiting once the whole file is sent, and the server's error message (the upload endpoint answers its errors with a 400 and the translated message in detail, so it shows in prod too);
    • the form submit is blocked, with a message above the panel, while files wait, upload or have failed. The click on a submit button is blocked too, so hosts like the Sylius loadable form don't freeze, and an ngrm-submit-blocked event lets other hosts undo their own submit state. Buttons with formnovalidate or data-ngrm-skip-submit-block (eg. Cancel, Delete draft) are never blocked, and in a hidden tab the message is also shown at the top of the page;
    • hosts which save without a form submit (eg. AJAX in Akeneo) call window.ngrmBlockSubmitIfUploadsPending(root) before saving, and every panel carries data-ngrm-uploads-pending;
    • a row upload and a retry disable the panel and show progress like Upload all, and running uploads are cancelled when the panel is destroyed;
    • the rows stack in a narrow container;
    • Enter in the file name and new folder inputs doesn't submit the form, and every folder picker has an accessible name.
  • Picker: multi-select, drag to reorder (also in a compact view for long galleries, and the page scrolls while an item is dragged), items already in the field are marked as added and can't be added twice. Folder placeholders never create folders in Cloudinary, and "Create folder" works from the upload folder picker. Facets are loaded when they're first needed, and a failed load of folders or media shows an error.
  • Preview shows the icon of the file format (pdf, zip, doc, xls, audio, txt), also for images the browser can't show.
  • CKEditor: the preview sends one debounced change event again (no focus loss while typing), the embed CSS class and variation inputs are back, and /configuration returns all labels of the new UI. A widget's old Vue instance is destroyed when CKEditor renders it again.
  • The form templates and /configuration build their translations from one list (VueTranslations, ngrm_vue_translations()), checked by a test against the keys the Vue app reads. Norwegian translates the whole UI now, Croatian has the new keys, the folder picker's own texts are translated, ngremotemedia.nb.yaml is removed (Symfony falls back from nb to no), dead keys are removed.
  • Docs: FORM.md has a complete entity example (ManyToMany with a unique inverse join column, OrderBy on position, addX/removeX so orphan removal works), describes the payload, the required field, uploading files and saving while files aren't uploaded. CHANGELOG and UPGRADE.md have the 4.0 entries, including the OneToOne to to-many migration as a Doctrine migration class and the removed elements of the interface.
  • Tests: persistence test with Doctrine (POST, flush, reload: order, removal, additions), widget rendering test, entry validation, missing payload, view after an invalid submit, the translation list, the cloud value merge, the location update, the missing resource log, the Version040000 migration (up, down, up), the lookup limit, repeated entries and the upload name limit.
  • Dist assets in bundle/Resources/public rebuilt (Node 12).

Behaviour changes:

  • RemoteMediaType data is always a collection. Single fields need a to-many relation and 'upload_limit' => 1; a field bound to a single RemoteResourceLocation fails with a TransformationFailedException. UPGRADE.md has the migration.
  • An empty field is an empty collection, not null, so NotBlank and NotNull no longer make it required. Use Count(min: 1).
  • The only form child is collectionPayload. The named children (locationId, remoteId, altText, ...) and the hidden uploadLimit field are gone, so custom form themes that render them must be updated.
  • The 3.x markup is gone: .ngremotemedia-remove-file, .ngremotemedia-scale, the quick upload button with its file input (new_file), and the hidden input.media-id inputs. UPGRADE.md lists what replaces them.
  • If a resource no longer exists in Cloudinary when its metadata is saved, from the form or from CKEditor (location/create, location/update), the local resource and its locations are kept and a warning with the remote id is logged. A submitted resource that exists neither locally nor in Cloudinary is left out as before, now with a warning too. Before, it was deleted locally, which also removed it from every other field using it. The Cloudinary delete notification and netgen:remote_media:refresh --delete still delete.
  • interactions.html.twig no longer takes location_id. Templates pass locations, and collectionPayload in input_fields.
  • An empty field is now isEmpty(), so optional CollectionType entries with delete_empty whose fields are all empty are removed.
  • handleRemoteUpdate() compares and stores tags sorted, so a different tag order no longer triggers a Cloudinary update on every save, and it stores an empty alt text or caption as null.
  • The ngrm-change event also carries config, and selectedImage.uploadedResources lists all items of the field.
  • The upload endpoint returns a 400 JSON response (detail) for a missing file, an unsupported visibility, a failed upload and a folder and file name over 240 characters, instead of throwing an InvalidArgumentException (500) or uploading. It uploads to the root folder also for undefined and (root), the values the interface sends for the root. The Upload controller takes the folder mode and use_asset_folder_as_public_id_prefix as optional 4th and 5th arguments.
  • RemoteMediaType errors are attached to the field, not to the parent form (error_bubbling is false).
  • The frontend lock file was re-resolved: Vue 2.6 to 2.7, vue-select 3.2 to 3.20, @babel/core 7.6 to 7.28, and regenerator-runtime became a direct dependency. vuedraggable is new. Builds use Node 12.

Notes:

  • netgen/layouts-remote-media and netgen/remote-media-ibexa need a release that allows netgen/remote-media-bundle ^4.0 and passes locations instead of location_id to interactions.html.twig.
  • Enforcing a fixed folder on the upload endpoint is left for a separate ticket; this PR enforces it in the UI.
  • allowed_types checked only after the upload, allowed_tags without a server check and hide_filename doing nothing are older than this PR and are tracked separately. So are the missing CSRF protection of the endpoints, the 500 on an empty or oversized upload and on a missing folder, and the storeLocation() flush, which also flushes other pending changes of the host.
  • The Norwegian strings still need a check by a native speaker.
  • Rebased onto current 4.0 (with Jglweb 1832 cke5 plugin #126, JGLWEB-1835 add local alt text and caption overrides #128, Doctrine migations configuration + initial migrations #129, Create integration tables in core migrations #132, JGLWEB-1835 add generateLocationHtmlTag() to ProviderInterface #133).
  • Tested against sklepex and akeneo. sklepex moved its 11 single fields to collections with Doctrine migrations (run up/down/up on a copy of the dev database). Akeneo stores the attribute values as lists and blocks its AJAX save with ngrmBlockSubmitIfUploadsPending(). Browser tests in both cover the product, taxon, contributor, channel, CMS, Author and attribute fields.

Comment thread docs/CHANGELOG.md Resolved
@RandyCupic

Copy link
Copy Markdown
Member Author

@mivancic When you select multiple images in gallery, and then you go to select more, it doesn't show these that are already added as selected or grayed out. In fact, you can select them again. It won't add them again but it messes up with limitation. For example, I've put limit to 5 and I've selected 3 images. Then I went to select more, and again I've selected 2 of the same images so I was not able to select more (as I already had 5 images in total) but when you actually go to add them, there are only 3.

@mivancic

Copy link
Copy Markdown
Member

Thanks, reproduced. The picker only got the number of items already in the gallery, not which ones, so you could pick them again. They counted towards the limit, which blocked selecting more, and were then dropped as duplicates when added. Interactions now passes the IDs of the items already in the field through MediaModal to MediaGallery. Those items show as "Added", greyed out and not clickable, and they don't count towards the selection. The selection bar messages are now translated as well (en, hr, no, nb)

@RandyCupic RandyCupic left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through the code, translations and docs. I ran it in a Symfony 7.4 test app (with the #125 commits applied) and, at the exact head, in sklepex with CKEditor 5. I tested uploads in both folder modes, the picker, reorder, crops, protected files, the limits and tampered payloads.

Nice work. The per-file upload, folder for all files or per file, rename, the picker with "Added", and the server-side limit and ownership checks all work. A few things before merge.

Rebase first

I merged 3.0 into 4.0 (58299f95), and #133 is in too. 4.0 now has the Doctrine migrations (#129, #132), the alt/caption overrides (#128), the CKEditor 5 changes (#126) and generateLocationHtmlTag() on ProviderInterface. Please rebase multiupload onto it before the rework, so the overrides and the new position migration go in once.

  • A test merge conflicts in Interactions.vue, Preview.vue, interactions.html.twig, RemoteMediaTransformerTest.php, CHANGELOG.md, UPGRADE.md and the three dist files. For the dist files, take either side and rebuild (Node 12).
  • RemoteMediaTransformer and RemoteMediaType merge cleanly, but the collection path then drops altTextOverride/captionOverride, and every gallery save resets them to null. Per-item alt and caption should be the overrides, so carry them through the payload.

Must fix

  • The data is always a collection, limit 1 too, and the core keeps the order. See inline on isCollection() and RemoteMediaCollectionTransformer.
  • A missing collectionPayload empties the field, see inline.
  • CKEditor: focus is lost while typing, the embed CSS class and variation inputs are gone, and some labels are blank. See inline on Preview.vue and Configuration.php.
  • Upload panel: replacing at limit 1, parent_folder, a fixed folder, upload guards, retry, the row limit, folder create. See inline.
  • Entry type validation, missing resource handling, docs. See inline.

Smaller

  • "Clear completed" also removes error rows, including 409s with "use existing".
  • The same file queued twice isn't detected. "Use existing" for something already in the field shows success and adds nothing.
  • An empty filename can be uploaded.
  • An empty field now says "Manage media" (it was "Select media"). The visibility select shows even with a single option.
  • .limit-indicator is only styled inside MultiUploadInline. vuedraggable's :options is deprecated and warns in the console.
  • The per-row inputs and the icon buttons need labels or aria-labels.

Translations

  • no/nb: the new UI mixes Norwegian and English ("Overwrite (bruk på alle filer)", "Select" next to "Fjern markering"), because the new components reuse keys that were never translated. Please translate those and have someone who speaks Norwegian check them.
  • Dead keys: multi_upload.title, multi_upload.status.uploading, limit_info, and upload.button.use_existing_resource (mapped, but nothing reads it). Remove them or wire them up.
  • en: use sentence case like the rest of the file ('Upload all', 'Clear completed').

Tests

  • An owned location is kept in collection mode.
  • Reorder and removal of persisted items, with the real transformer.
  • Non-string entry fields.
  • An omitted field.
  • buildView after an invalid submit.
  • The Configuration keys.
  • One end-to-end test (POST → entity → flush → reload) that checks the order.

Please also update the PR description, it still mentions RemoteMediaCollectionType. I'll rebase platform (#125) after your rebase. allowed_types being checked only after the upload, allowed_tags without a server check and hide_filename doing nothing are older than this PR, so I'll take them as separate tickets.

Comment thread lib/Form/Type/RemoteMediaType.php Resolved
Comment thread lib/Form/Type/RemoteMediaType.php Resolved
Comment thread lib/Form/Type/RemoteMediaType.php Resolved
Comment thread lib/Form/Type/RemoteMediaType.php Resolved
Comment thread docs/UPGRADE.md Resolved
Comment thread frontend/package.json Resolved
mivancic and others added 24 commits November 14, 2026 10:20
Implement upload-limited multi-resource handling with multi-select and
reorderable gallery cards, split RemoteMediaType into single and
collection form types, convert the multi-gallery components to
props-down/events-up data flow, and improve the multi-upload UX, i18n
and wire format. Add a Norwegian Bokmål (nb) translation file.

Fix the CKEditor "Manage Media" modal so the gallery renders in
collection mode (default the embed to single-select and guard the
missing multi-select translation key that was blanking the gallery).
Includes rebuilt NGRM frontend assets (remotemedia.js +
remotemedia.css).
Clearing a gallery now sticks, folder placeholders no longer create Cloudinary folders and existing CKEditor embeds load their media. Malformed payloads fail the form instead of emptying the collection.
Browsing or uploading into a gallery now skips resources that are already in it and stops at the upload limit, and replacing a single image keeps its watermark.
…mote

The metadata is still saved locally, and the warning names the remote id so missing assets can be found.
Import order and missing function imports, no short ternary in the collection transformer, and intersection-typed provider mocks in the form type tests.
The multi-upload rewrite dropped the always-present remoteId input, so removing the media from a single field sent nothing and forms that keep the previous value on a missing field could not clear it. Dist rebuilt with Node 12.
Nothing in the Vue app reads the legacy label block, so keep it as on 4.0.
Items already in the field can no longer be picked again and use up the upload limit. Dist rebuilt with Node 12.
upload_limit 1 returns a single location, anything else a collection. Single fields need 'upload_limit' => 1, see UPGRADE.md.
Dist rebuilt with Node 12.
Nothing reads them; the interface uses the ngrm.edit.vue.* keys.
Load more now sits between the grid and the selection bar instead of covering it. Dist rebuilt with Node 12.
Keys like 'limit_reached': 'limit_reached' won over the English fallbacks in the Vue components, so CKEditor showed the raw key whenever /configuration did not send the translation. The isCollection flag is gone as well: form fields always submit a collection.
- Typing in a preview field only updates the state; the debounced handler sends one change event, so CKEditor no longer re-renders the widget after the first character.
- Bring back the CSS class and variation inputs for embeds and the preview.*_info tooltips.
- Gallery cards load previewUrl first and fall back to the original.
- Form fields always post collectionPayload, also with upload_limit 1; a limit of 1 only switches the picker to single select and makes new items replace the current one.
- An empty field shows "Select media" again.
- Labels for the per-item inputs, aria-labels for the reorder buttons, and vuedraggable options as props instead of the deprecated :options.
- "Create" opens the input on a real click. The menu is appended to <body>, so the click-outside handler cancelled the form; a click now only counts as outside when its mousedown also started outside the picker and its menu.
- Clearing the picker falls back to the configured parent folder instead of the root.
- Translate "Create folder in:", the root label and the create error, and read .detail before .message like the other requests.
Mario Ivančić added 22 commits November 20, 2026 11:36
@mivancic

Copy link
Copy Markdown
Member

Thanks for the approval, and sorry for coming back after it. Before merging I ran a full review of a39205e8 and tested it in the browser in sklepex and akeneo, on every field type there (products, taxons, contributors, channels, CMS, Author, product attributes). Most of it held up, but a few things would have lost data or blocked editors, so I fixed them on this branch. That's 37 commits on top of a39205e8, head e39f222d. Please have one more look, mostly at the first group.

Data loss and wrong saves

  • Hosts which save through AJAX (Akeneo) never got the submit block, so files still waiting or uploading were dropped on save. There is now window.ngrmBlockSubmitIfUploadsPending(root), which shows the same message, dispatches ngrm-submit-blocked and returns true, and every upload panel carries data-ngrm-uploads-pending ("Let hosts which save without a form submit block the save while files are not uploaded"). Akeneo uses it now.
  • A failed file was dropped without a word on save. It now blocks the save like a waiting one, until it's retried or removed. Dropping several files on a single field now says that only one is taken ("Block the save while a failed file is in the upload panel…").
  • Removing a file while it uploaded didn't cancel the request, and the file still ended up in the field. With limit 1 it silently replaced the image ("Cancel the upload of a file which is removed from the upload panel").
  • The idle timeout could cancel a large upload while the server was still passing it on to Cloudinary, and the retry then got a 409. After the whole file is sent, the panel now waits up to 30 minutes for the response ("Wait for the response of an upload after the whole file is sent").
  • A folder and file name longer than Cloudinary's 255-character public ID showed "Success" and then broke the save. The panel now refuses it before uploading, and the endpoint answers with a 400. The limit is 240 characters, which leaves room for the unique suffix, and the folder only counts where it's part of the public ID ("Reject an upload whose…", "Base the limit…", "Count the folder…").
  • The form theme's collectionPayload and the widget's were both posted. The widget now disables the rendered one once it's loaded ("Post the payload of a field once when the widget is loaded").
  • With the same resource in two fields, a cloud alt text edited in one field is now shown in the other one too, so the page doesn't show two different values ("Share the cloud alt text, caption and tags…"). The loaded merge from the last round stays as it was.

Server side

  • Required fields: NotBlank and NotNull accept an empty collection, so they don't make the field required anymore. sklepex tripped on that. UPGRADE.md and FORM.md now say to use Count(min: 1).
  • A new payload entry which repeats a resource of the field is ignored, the same as in the UI.
  • A field without upload_limit can look up at most 100 resources which aren't stored locally in one submission. Each one is a Cloudinary call, and before this there was no cap (MAX_REMOTE_LOOKUPS, ngrm.form.remote_lookups_exceeded).
  • The over-limit message says how many to remove ({{ excess }}), and FORM.md explains a field which is already over a lowered limit.

Regressions from 4.0 and smaller things

  • The folder picker of RemoteMediaFolderType opens expanded again.
  • The preview shows the file format icons again (pdf, zip, doc, xls, audio, txt), also for images the browser can't show (heic, tiff).
  • Facets load when the browser or the upload panel first needs them, instead of once per field on page load. That was 18 requests on a sklepex product page.
  • The browser and the folder tree show an error (the folder tree with a retry link) instead of hanging on "Loading folders…" or staying empty after a 500.
  • The watermark text is kept when the item of a single field is removed and another one is picked.
  • Preview object URLs are released, the upload table stacks its rows in a narrow column, and there is a compact gallery view. The page also scrolls while an item is dragged, so long galleries can be reordered.
  • Fallback texts for two upload errors. Empty crop settings render as {}, and empty loaded values as "". RemoteMediaType constructor props are readonly.
  • Docs: removed DOM hooks and classes in UPGRADE.md, the root folder values of the upload endpoint, and a new "Uploading files in the form" section in FORM.md.

Tests

836 tests, up from 769. They're green on PHP 8.1 with Symfony 5.4 (lowest and normal) and 6.4, and on PHP 8.4 with 6.4. phpstan and cs-fixer are clean. The new tests cover:

  • the cloud value merge;
  • handleLocationUpdate;
  • the missing resource log;
  • the Version040000 migration (up, down, up);
  • the lookup cap, the dedupe and the long name.

The dist is rebuilt with Node 12 and is reproducible from the source. The browser runs in sklepex and akeneo, rerun on e39f222d, give the same results as before, apart from the intended changes.

Left for separate PRs

These are older than this PR:

  • CSRF on the endpoints;
  • server-side allowed_types and visibility (folder is the existing ticket);
  • a 500 on an empty or oversized upload;
  • an HTML 500 for a missing folder;
  • Enter in the picker search.

Also left for separate PRs:

  • the storeLocation() flush, which also flushes the host's pending changes;
  • PHP 8.4 and JS lint in CI;
  • the 500 ms debounce of ngrm-change.

The null alt text and caption on SDK 3 stays with you in #125.

@RandyCupic RandyCupic left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-tested e39f222d in the Symfony lab and in sylius1, form fields and CKEditor embeds. Nice work, everything from your list holds up.

One thing before merge: a form field and a CKEditor embed have to behave the same, and they still don't in two places, see inline.

// CKEditor embeds stay out of it: they store a change right away, so a value
// taken over from a form field would be saved before the form is.
announceCloudValue(resource, field, value) {
if (this.config.mode === "embed" || !resource.id || !CLOUD_VALUE_FIELDS.includes(field)) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same resource in a form field and in a CKEditor embed on one page: alt, caption and tags aren't shared in either direction. I set alt r6-from-field in the field and r6-from-embed in the embed, and the page shows both. On save the field writes its value over the one the embed already stored, so the editor's last edit is lost.

I get why the embed shouldn't store a value taken over from the form, but it doesn't have to. Let the embed announce its own edits (they're already stored), and on an announced value only update what it shows, without the PUT. The field still sends its value as a change, so the form save writes it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 608606f, dist rebuilt in e977ac5. Done as you suggested: the embed announces its own edits, and the form field takes them over and saves them with the form. A value announced to the embed is only shown there, without the PUT. When the embed saves something else later (eg. the caption), it sends that value in takenOver, and location/update keeps the stored value for it. FORM.md and the CHANGELOG describe it.

// In a form field with a limit of 1 the watermark text outlives the item:
// the next one picked or uploaded takes it over, also after the item was
// removed. Not in a CKEditor embed, a removed embed leaves nothing behind.
watermarkText: this.isSingleMode && this.config.mode !== "embed" ? this.localSelectedImage.watermarkText || "" : "",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing with the watermark. In a field with limit 1, the text is kept after remove + pick (r6-wm). In the embed it's cleared (r6-wm-embed is gone). Drop the mode !== "embed" check so both keep it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in ccd46b1, the check is dropped, so the embed keeps the watermark text after remove and pick too.

@amalija-ramljak

amalija-ramljak commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

@mivancic ive run this locallly in a small sandbox scaffold symfony app just to test. I ran into an error - when i used the same cloudinary image in two fields, it threw a db error about unique keys. According to my LLM, this case is the only one where it should happen, because its a new image not yet saved in the DB, so its not reused in any way from the DB and tries to create the same remote id image twice. And supposedly it does not happen if its the same image but uploaded from the machine instead of from cloudinary, but that's only my LLM's guess

Example of error:

An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'upload|image|ngrm-sandbox/three-dogs_jpg' for key 'ngrm_remote_resource.UNIQ_4B1F1DB42A3E9C94'

Note - I haven't been checking the myriad of comments before me, so I don't know if it's already been mentioned.

cc @RandyCupic

@RandyCupic

Copy link
Copy Markdown
Member Author

@mivancic ive run this locallly in a small sandbox scaffold symfony app just to test. I ran into an error - when i used the same cloudinary image in two fields, it threw a db error about unique keys. According to my LLM, this case is the only one where it should happen, because its a new image not yet saved in the DB, so its not reused in any way from the DB and tries to create the same remote id image twice. And supposedly it does not happen if its the same image but uploaded from the machine instead of from cloudinary, but that's only my LLM's guess

Example of error:

An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'upload|image|ngrm-sandbox/three-dogs_jpg' for key 'ngrm_remote_resource.UNIQ_4B1F1DB42A3E9C94'

Note - I haven't been checking the myriad of comments before me, so I don't know if it's already been mentioned.

cc @RandyCupic

Hmm, this sounds familiar. It might be a bug that is also happening on the current version. I remember some issues with duplicate entry from Sentry but I was never able to reproduce them or discover what's going on, probably because I was testing the image that Sentry reported, which was at that moment already added in the database.

@mivancic

Copy link
Copy Markdown
Member

Thanks! Both are fixed, see inline. Tested in sklepex with the same image in a contributor's image field and in a CKEditor embed: an alt text typed in the field shows in the embed and isn't stored until the form is saved, an embed edit is stored right away and shows in the field, the form save keeps the last edit, and the embed keeps the watermark after remove and pick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants