[Feature][Storage template] add built‑in eq and or helpers (allow conditional folders for extensions like .insp / .insv) #18029
Closed
andreymaznyak
started this conversation in
Feature Request
Replies: 1 comment
-
That feature would be very useful, why was the request closed? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have searched the existing feature requests, both open and closed, to make sure this is not a duplicate request.
The feature
Immich’s storage template is powerful, but Handlebars lacks native string comparison.
Two tiny built‑in helpers—eq and or—would let users route large Insta360 .insp / .insv files into a separate drive without pulling in the 130‑helper handlebars‑helpers package. The change is few lines in StorageTemplateService.
⸻
Background
• Storage templates let us craft on‑disk paths (e.g. {{y}}/{{MM}}‑{{MMMM}}/…) .
• Handlebars’ core only offers truthy #if; there is no string equality or logical OR  .
• External library handlebars‑helpers provides those helpers but drags 130 + functions into Immich .
• Insta360 X3 records heavy dual‑lens videos as INSV/INSP; users often mount a separate volume for them  .
⸻
Current vs. Desired Templates
Situation Template
Today (works) hbs{{y}}/{{MM}}-{{MMMM}}/{{filetype}}/{{y}}-{{MM}}-{{dd}}{{HH}}-{{mm}}{{filename}}
Wanted (needs helpers) hbs{{y}}/{{#if (or (eq extension "insp") (eq extension "insv"))}}360Media/{{/if}}{{MM}}-{{MMMM}}/{{filetype}}/{{y}}-{{MM}}-{{dd}}{{HH}}-{{mm}}{{filename}}
Live demo: https://codepen.io/andreymaznyak/pen/EaaQMbO.
⸻
Proposed Change
1. Register two minimal helpers right before any template compilation:
// server/src/services/storage-template.service.ts
import handlebars from 'handlebars';
handlebars.registerHelper('eq', (a, b) => a === b);
handlebars.registerHelper('or', (a, b) => a || b);
Platform
Beta Was this translation helpful? Give feedback.
All reactions