Skip to content

add .nomedia file#363

Closed
ygxbnet wants to merge 2 commits into
risin42:devfrom
ygxbnet:dev
Closed

add .nomedia file#363
ygxbnet wants to merge 2 commits into
risin42:devfrom
ygxbnet:dev

Conversation

@ygxbnet
Copy link
Copy Markdown
Contributor

@ygxbnet ygxbnet commented May 19, 2026

Add .nomedia files to the Telegram Images and Telegram Video folders to prevent cached images and videos from being scanned by the system gallery.

Summary by CodeRabbit

  • Bug Fixes
    • Ensures newly moved or initialized photo and video folders receive hidden placeholders so they are excluded from system media scanning, preventing migrated media from appearing in galleries.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e1730086-751c-45e3-8a39-4f328ea549ed

📥 Commits

Reviewing files that changed from the base of the PR and between dcffb30 and f8fcc8c.

📒 Files selected for processing (1)
  • TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java

Walkthrough

This PR adds creation of empty .nomedia placeholder files in the Telegram Images and Telegram Video directories inside ImageLoader.createMediaPaths() immediately after those directories are moved/initialized.

Changes

Media scanner prevention via .nomedia files

Layer / File(s) Summary
.nomedia file creation in media path setup
TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java
Adds calls to AndroidUtilities.createEmptyFile() to create .nomedia files in the Telegram Images directory and in the Telegram Video directory immediately after successful directory setup/move.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add .nomedia file' directly matches the main change: adding .nomedia placeholder files to Telegram directories to prevent gallery scanning.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.42.2)
TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ed1d1cd8-5d24-4491-93a3-2af0e2f127cc

📥 Commits

Reviewing files that changed from the base of the PR and between e3e4419 and dcffb30.

📒 Files selected for processing (1)
  • TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java

Comment thread TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java Outdated
@risin42
Copy link
Copy Markdown
Owner

risin42 commented May 22, 2026

We shouldn’t need to add a .nomedia file under Android/data/<package>/files/Telegram/Telegram Images. Could you share more details, like which gallery app you’re using and the full path of the images you’re seeing?

@ygxbnet
Copy link
Copy Markdown
Contributor Author

ygxbnet commented May 22, 2026

When using this app on Android 10 with external storage enabled, NagramX creates "Telegram Images" and "Telegram Video" folders under /storage/emulated/0/Telegram and caches images and videos there. Since this directory is scanned by most photo galleries including the system gallery, so I added a .nomedia file.

Screenshot_20260522_215044

@risin42
Copy link
Copy Markdown
Owner

risin42 commented May 23, 2026

Fixed in cbbaba5

@risin42 risin42 closed this May 23, 2026
@ygxbnet
Copy link
Copy Markdown
Contributor Author

ygxbnet commented May 23, 2026

I tested, It can work. Thank you very much!

Screenshot_20260523_114102_bin mt plus_edit_291161000605569 Screenshot_20260523_114014

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.

2 participants