Skip to content

[BUG] Leading zeros are stripped from template filename when starting with tt0xxxx #1139

@ghdoca

Description

@ghdoca

Describe the bug
When creating a file from a template and the filename is an imdbId like tt0780504 the leading zero is deleted and the filename is tt780504.
This happens when the file name format is off and the input is manual or the file name format is on and the input is from a variable.
If the variable is prefixed with "" it does not work as obviously this is not allowed in a filename.

To Reproduce
Steps to reproduce the behavior in Obsidian:

  1. Open Obsidian and create a macro and then add a template
  2. Run the macro and it will ask for a filenname
  3. Input tt0780504 and filename is tt780504

Expected behavior
It should not strip the leading zero.

Obsidian Debug Info (required for bug reports)

	Obsidian version: 1.12.5
	Installer version: 1.12.4
	Operating system: Windows 11 Enterprise
	Login status: logged in
	Language: en
	Live preview: on
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 11
	Plugins enabled: 11
		1: Auto Link Title v1.5.5
		2: Dataview v0.5.68
		3: Linter v1.31.2
		4: List Callouts v1.2.9
		5: Meta Bind v1.4.6
		6: Metadata Menu v0.8.12
		7: Plugin Update Tracker v1.7.0
		8: QuickAdd v2.12.0
		9: Recent Files v1.7.6
		10: Tasks v7.23.1
		11: Templater v2.18.1

Screenshots
Image

Environment (please complete the following information):

  • Obsidian version: see above
  • QuickAdd version: latest
  • Operating system: Windows 11
  • Debug info: QuickAdd: (LOG) TemplateEngine.createFileWithTemplate: Collected 0 template property variables for Movies/tt780505.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions