Skip to content

Images saved with .jpg_ extension instead of .jpg - prevents Obsidian from displaying embedded images #346

Description

@gaplikov911-ux

Problem

When syncing images from Telegram to Obsidian using the Telegram Sync plugin, image files are being saved with an incorrect extension: .jpg_ instead of .jpg. This causes Obsidian to fail to find and display embedded images.

Expected Behavior

  • Image files from Telegram should be saved with the correct extension (.jpg, .png, etc.)
  • Obsidian should be able to display images using the wikilink format: ![[photos/photo_name.jpg]]
  • Images should display automatically in notes without manual file renaming

Actual Behavior

  • Image files are saved as photo_229642654_263-20251127193540.jpg_ (with underscore after extension)
  • When the bot creates notes with embedded image links like ![[photos/photo_229642654_263-20251127193540.jpg]], Obsidian cannot find the file
  • Error message in Obsidian: "photos/photo_229642654_263-20251127193540.jpg" cannot be found
  • Images only display after manually renaming the file to remove the trailing underscore

Steps to Reproduce

  1. Configure Telegram Sync with File path template: Telegram-лента/photos/{{file:name}} - {{messageTime:YYYYMMDDHHmmssSSS}}.{{file:extension}}
  2. Send JPG image from Telegram to the bot
  3. Check the created file in Obsidian vault
  4. Observe that file extension is .jpg_ instead of .jpg
  5. Try to view the image using embedded wikilink in the note
  6. Image fails to display because file cannot be found

Workaround

Files display correctly after manually removing the trailing underscore from the file extension (.jpg_.jpg). After renaming, Obsidian automatically updates the links and displays the images correctly.

Related Issue

This appears to be related to issue #344 "Images saved in the database with the .file extension instead of jpg" - same root cause (incorrect extension formatting) but different symptom (underscore suffix instead of .file extension).

Additional Context

  • The template successfully creates both files and links with mostly correct format
  • The file extension generation adds an unexpected underscore character at the end
  • This breaks the file reference between the wikilink in the note and the actual filename in the photos folder
  • The issue affects all image types (jpg, png, mp4, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions