Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update instapaper import - #8558

Open
rootshellz wants to merge 4 commits into
wallabag:masterfrom
rootshellz:update_instapaper_import
Open

Update instapaper import#8558
rootshellz wants to merge 4 commits into
wallabag:masterfrom
rootshellz:update_instapaper_import

Conversation

@rootshellz

Copy link
Copy Markdown
Contributor
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Documentation no
Translation no
CHANGELOG.md no
License MIT

This PR updates the Instapaper importer to support the newer CSV export format while keeping full backward compatibility with the existing 4-column format.

Instapaper now exports CSVs with 6 columns:

  • Old format: URL,Title,Selection,Folder
  • New format (as of at least 2025-11-20): URL,Title,Selection,Folder,Timestamp,Tags
    • where Tags is a JSON array (e.g. ["programming","go","security"]).

This PR:

  • Detects whether the imported file is in the old or new format.
  • For the new format, parses the JSON Tags column and assigns those tags to the entry.
  • For the old format, keeps the existing behavior of turning the Folder into a tag, except when it is one of the status folders (Unread, Archive, Starred).
  • Uses the Timestamp column (Unix epoch) to set Entry::createdAt when available, preserving the original Instapaper creation time.
  • Stores the current user’s ID before em->clear() and reattaches the User entity via getReference() in parseEntry(), ensuring findByUrlAndUserId() always has a valid user and avoiding issues when the user entity has been detached.
  • Adds unit tests and a new CSV fixture (instapaper-export-new.csv) to cover the new export format and tag assignment behavior.

No BC breaks: existing Instapaper exports in the old 4-column format continue to work as before.

@rootshellz

Copy link
Copy Markdown
Contributor Author

Just noticed the check failing. Will take a look.

@rootshellz
rootshellz force-pushed the update_instapaper_import branch from 50b27da to 79b783a Compare November 21, 2025 05:30

@yguedidi yguedidi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

great catches and work! thanks for your contribution!
few comments from me.
and I think after the removal of the bugfix from this PR, it can be a single clean commit

Comment thread src/Import/InstapaperImport.php Outdated
Comment on lines +48 to +49
// Store user ID to reattach user entity after em->clear()
$this->userId = $this->user->getId();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd say this fix deserves its own PR to fix it in all impacted importers :)

@yguedidi yguedidi Nov 22, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BTW, I think a cleaner and more global fix would be to update \Wallabag\Import\AbstractImport::parseEntries to not clear everything but to manually detach the entries and associated tags.
this way, the user is never cleared

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and as a fix, maybe the dedicated PR should target 2.6? we will handle the forward port when merging 2.6 in master

$this->tagsAssigner
->expects($this->exactly(3))
->method('assignTagsToEntry')
->withConsecutive(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

better not introduce a usage of withConsecutive as it's deprecated in PHPUnit

@yguedidi yguedidi added this to the 2.7.0 milestone Nov 22, 2025
@benjuade

Copy link
Copy Markdown

@rootshellz should your PR fix the issue that I've opened here in september #8468 ?

@Kdecherf

Kdecherf commented May 4, 2026

Copy link
Copy Markdown
Member

Hello @rootshellz, would you be able to take a look at the feedback and update your PR?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants