Skip to content

fix: accept folder.view2 exports in Import Everything - #53

Merged
chodeus merged 2 commits into
betafrom
fix/import-everything-accepts-folder-exports
Aug 9, 2026
Merged

fix: accept folder.view2 exports in Import Everything#53
chodeus merged 2 commits into
betafrom
fix/import-everything-accepts-folder-exports

Conversation

@chodeus

@chodeus chodeus commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Problem

A folder.view2 user reported their backup JSON could not be imported into FolderView3 and that they had to convert it by hand.

The file was always importable — Import Docker / Import VM accept a bare folder.view2 export verbatim. Import Everything rejected it, because importAll requires an fv3_export_version wrapper and folder.view2 has no such concept: it downloads Docker.json / VM.json, a bare id => folder map, or a single folder object.

The guard was one-directional. importDocker/importVm already detect a full bundle and redirect to Import Everything, but nothing pointed the other way — the error read Not a valid FV3 backup file., which reads as "your file is broken" and sends people off to convert a file that never needed converting.

Change

Import Everything now detects a bare folder export and offers Docker folders / VM folders, reusing the same import path as the dedicated buttons.

Two details worth calling out:

  • The type choice is buttons, not confirm/cancel. sweetalert reports ESC and Cancel identically (doneFunction(!1)), so mapping the two types onto that boolean would silently import as whichever type mapped to false whenever the dialog was dismissed.
  • The buttons are bound with addEventListener. An inline onclick inside sweetalert's own markup compiles but never fires — the modal swallows the click, so the dialog would appear and do nothing.

fv3ImportFolderMap() is extracted so the docker, vm and folder-export paths share one loop instead of three copies. Behaviour is unchanged, including vm import not calling sync_order.

Detection

A payload counts as a folder export only when it is a single folder object, or a non-empty map whose every value is folder-shaped (name string, plus a containers array or settings object). Anything else still gets Not a valid FV3 backup file. Verified against {}, arrays, css-config.json, settings.json, and maps containing a non-folder member.

Testing

Verified on Unraid 7.3.2 against plugin 2026.08.01, driving a real File through the real file input:

  • folder.view2 map (2 folders) -> modal reports "2 folders" -> Docker folders -> both present in docker.json, original ids and regex intact
  • single-folder export -> modal reports "1 folder" (singular)
  • folder.view2 map -> VM folders -> written to vm.json, docker.json untouched
  • negative cases rejected as before
  • ESC / Cancel writes nothing

Imported folders keep their folder.view2 ids, so members and settings carry over unchanged.

Summary by CodeRabbit

  • New Features

    • Added support for importing folder exports from full backups.
    • Users can choose whether valid exports are imported as Docker or VM folders.
    • Import results now show the number of folders detected.
    • Imported folders are automatically added, ordered, and displayed in the refreshed table.
    • Supports both single-folder and multi-folder exports.
  • Bug Fixes

    • Invalid or unsupported export files continue to be rejected with an error message.

Import Everything rejected any file without an fv3_export_version wrapper,
so a folder.view2 backup dead-ended on "Not a valid FV3 backup file." The
file was always importable — the dedicated Import Docker/Import VM buttons
take it verbatim — but nothing pointed there, and those buttons already
detect the reverse mistake and redirect. Only this direction was missing.

Import Everything now detects a bare folder export (one folder object or an
id => folder map) and offers Docker/VM buttons, reusing the same import path
as the dedicated buttons.

The type choice is buttons rather than confirm/cancel because sweetalert
reports ESC and Cancel identically, so a dismissal would silently import as
whichever type happened to map to false. They are bound with addEventListener:
an inline onclick inside sweetalert's own markup compiles but never fires.

Extract fv3ImportFolderMap() so the docker, vm and folder-export paths share
one loop instead of three copies. Behaviour is unchanged, including vm import
not calling sync_order.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bb83b577-d4e0-4cb4-be1a-1bbf4a4605d4

📥 Commits

Reviewing files that changed from the base of the PR and between 4e9fd2b and 7e503c9.

📒 Files selected for processing (1)
  • src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/folderview3.js

📝 Walkthrough

Walkthrough

The change centralizes folder-export validation and import handling for Docker, VM, and full-backup imports. Full-backup imports now count valid folder exports and require a Docker or VM selection.

Changes

Folder export import

Layer / File(s) Summary
Shared validation and import wiring
src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/folderview3.js
Shared logic validates and imports single-folder objects and folder maps. Docker and VM imports use the shared helper.
Full-backup export selection
src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/folderview3.js
Full-backup imports accept valid folder exports, show folder counts, and require a Docker or VM selection before import. The selection wrapper closes the dialog and reports import errors.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FullBackupImport
  participant SelectionDialog
  participant fv3ImportFolderMap
  participant FolderAPI
  participant FolderTable
  FullBackupImport->>FullBackupImport: validate export and count folders
  FullBackupImport->>SelectionDialog: present Docker or VM choices
  SelectionDialog->>fv3ImportFolderMap: import selected export
  fv3ImportFolderMap->>FolderAPI: create or update folders
  fv3ImportFolderMap->>FolderTable: refresh table
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: accepting folder.view2 exports in Import Everything.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/import-everything-accepts-folder-exports

Comment @coderabbitai help to get the list of available commands.

@chodeus

chodeus commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chodeus

chodeus commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/folderview3.js`:
- Around line 157-165: Update fv3ImportFolderMap to use
fv3IsFolderShaped(content) instead of the truthiness check on content.name when
selecting the import mode. Route structurally valid single-folder exports,
including empty names, through create.php; otherwise process the folder map with
update.php and preserve the existing docker order synchronization.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 74d4fb44-12c4-4c18-8f41-e8f1efca5294

📥 Commits

Reviewing files that changed from the base of the PR and between 4e9fd2b and 2d793ac.

📒 Files selected for processing (1)
  • src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/folderview3.js

fv3ImportFolderMap picked its import mode with `if (content.name)`. An empty
name is legal, so a single-folder export named "" fell through to the map
branch and its own keys were posted as folder ids — name, icon, settings,
regex, containers, actions all pass update.php's id charset, so six junk
folders got written. The inverse also misfired: a map whose folder id is the
string "name" was treated as a single folder.

Select on fv3IsFolderShaped() instead, which is the same predicate detection
already uses, so the two agree.

Pre-existing in importDocker/importVm; fixing it in the shared helper covers
both buttons.
@chodeus

chodeus commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chodeus

chodeus commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 57 minutes.

@chodeus

chodeus commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chodeus

chodeus commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 12 minutes.

@chodeus

chodeus commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@chodeus
chodeus merged commit b1a7786 into beta Aug 9, 2026
2 checks passed
chodeus added a commit that referenced this pull request Aug 14, 2026
The remove block ran `removepkg folder.view3-<version>`, but since 2026.07.07.1
the package is named folder.view3-<version>-x86_64-1. removepkg aborted with
"No such package ... Can't remove" while the following rm -rf lines still
deleted the plugin dir and flash config, orphaning the /var/log/packages entry.
upgradepkg --install-new then reported "Skipping package ... (already
installed)" on reinstall, so files were never extracted and the plugin came
back dead while plugin-manager reported success.

- Remove now globs /var/log/packages/folder.view3-* and removepkg's each
  basename: version-agnostic, and it also clears legacy pre-2026.07.07.1
  entries the old exact-name call could never match. Siblings folder.view and
  folder.view2 do not match the glob.
- Install gained --reinstall so a stale entry can never suppress extraction.
- The package name now has a single definition (&pkgname;) referenced by the
  pre-install prune, the install FILE/URL and the post-install keep-check, so
  the four-way hand-reconstruction that allowed this drift is gone.

Builds beta 2026.08.14.1, bundling the two fixes already on beta: folder.view2
exports accepted by Import Everything (#53), and autostart membership matching
what the Docker page renders (#54).
chodeus added a commit that referenced this pull request Aug 14, 2026
Merges beta into main and builds the stable package.

- Uninstall removes the plugin cleanly: the remove block matched the
  package DB entry without its -x86_64-1 suffix, so removepkg aborted
  while the following rm -rf lines still deleted the plugin dir and
  flash config. The orphaned entry then made upgradepkg skip extraction
  on reinstall, leaving the plugin installed-but-dead.
- Import Everything accepts a folder.view2 backup file (#53).
- Container autostart order matches the folder membership the Docker
  page renders, including label-assigned containers (#54).

CHANGES consolidated to a single ###2026.08.14 heading; main keeps its
stable changelog history rather than beta's per-build entries.
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.

1 participant