Skip to content

Import failing when importing a vcard-button #976

Description

@andi98

LinkStack version

4.8.6

Description

Hello, when importing a link export from one user to another user on the same instance it fails when the JSON file contains a link with "type": "vcard".
I get a "Invalid link" exception from UserController:

if ($validatedData->fails()) {

Probably the validator fails for the JSON in the "link" attribute.

Details about your system

Docker on Debian

How to reproduce

Export the bookmark list from a user with a vcard-button and try to import it for another user.

Possible Solution

No response

Additional Context

No response

Activity

  1. JulianPrieber commented on May 7, 2026

    @JulianPrieber
    Member

    Could you throw the link export into something like https://jsonformatter.curiousconcept.com ?

    It's probably just a formatting/parsing error.

    The export is formated in json, the vcard data is stored as json in the database.

    If the quotes in the vcard data isn't escaped properly when exporting, the importer can't read the file properly.

    Normally you should just get something like a "failed to import" error on your dashboard. I'll have to take a look at that.

    If that's the case, the import system should be able to read the properly formatted data already.

    If we can test any individual issue here, we can start to rule out more specific formatting issues.

    @andi98 if you send me an email with your link export I might be able to send you a patched file you could try.

  2. sridharkalaibala commented on Sep 13, 2026

    @sridharkalaibala

    I isolated a validation failure on current main (7bd6cea) that does not depend on malformed JSON.

    blocks/vcard/handler.php stores the contact as JSON in link. exportLinks() serializes that string inside the outer export, but importData() applies nullable|exturl to every imported link, including type: "vcard". The exturl rule accepts only http, https, mailto, and tel schemes, so correctly encoded contact JSON fails it.

    I ran the actual exturl closure from AppServiceProvider.php under PHP 8.3.6 with synthetic contact data, including quotes in the organization name. Both layers of JSON decode successfully and preserve the contact exactly, but the rule rejects the vCard value; an HTTPS URL passes as a control.

    This is an isolated validator reproduction, not a completed database import test. PR #962 changes vCard generation and does not touch this import validation. A fix needs type-appropriate validation for the contact payload while retaining URL validation for ordinary links. Simply reformatting a valid export won't address this particular rejection.

  3. sridharkalaibala commented on Sep 13, 2026

    @sridharkalaibala

    The controller/database reproduction is now complete, and I opened draft #1004. On original main, importing the valid vCard returned an error after removing the user's existing links. The change validates link payloads first and uses JSON-object validation for vCards.

    All 13 focused tests pass against the change using the real Laravel controller, UploadedFile requests, repository migrations and SQLite. The draft explains the existing lockfile/test-suite setup problems and the validation limits; it does not claim a browser/MySQL test or transactional rollback for every possible import failure.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions