Skip to content

fix: remove namespace from file names#60

Merged
SomeMWDev merged 1 commit intomainfrom
development
Oct 24, 2025
Merged

fix: remove namespace from file names#60
SomeMWDev merged 1 commit intomainfrom
development

Conversation

@SomeMWDev
Copy link
Member

@SomeMWDev SomeMWDev commented Oct 24, 2025

Closes #55

Summary by CodeRabbit

  • Bug Fixes
    • Improved file lookup mechanism for wiki images to ensure accurate identification and proper retrieval of image resources.

@SomeMWDev SomeMWDev self-assigned this Oct 24, 2025
@SomeMWDev SomeMWDev added the bug Something isn't working label Oct 24, 2025
@SomeMWDev SomeMWDev moved this to In Progress in IRWA Templates Taskboard Oct 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2025

Walkthrough

Updated file name handling to remove "File:" prefix from stored data and conditionally add it during wiki API queries. Nine image entries in data/files.json had the prefix stripped, while bot.ts now constructs the query with the prefix when needed, fixing the badfilename warning.

Changes

Cohort / File(s) Change Summary
Wiki API Query Construction
bot.ts
Updated imageinfo query to prepend "File:" prefix to file names when constructing titles parameter: titles: File:${file.wikiFileName}. Enhanced log message to prefix output with "File" for clarity.
Image File Metadata
data/files.json
Removed "File:" prefix from wikiFileName values across nine image entries, storing only the base file name (e.g., "PHIGHTINGWikiLogo.png" instead of "File:PHIGHTINGWikiLogo.png").

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Remove Outlaster #46: Both PRs modify wikiFileName values in data/files.json, with this PR removing the "File:" prefix while the other removed entries using the prefixed name format.

Suggested labels

wikis, templates

Poem

🐰 A file by any other name—
With prefixes now rearranged—
The query knows where to find fame,
And warnings have been exchanged.
Clean data hops along the way,
API calls no longer fray!

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix: remove namespace from file names" directly summarizes the main change in the changeset. The primary modification in data/files.json removes the "File:" namespace prefix from nine image entries, which is exactly what the title conveys. The related change in bot.ts adds the "File:" prefix back when querying the API, which complements the namespace removal strategy. The title is concise, clear, and specific enough for a teammate to understand the core change.
Linked Issues Check ✅ Passed The PR changes directly address issue #55's objective to fix the badfilename warning. The warning references filenames being flagged without proper namespace handling, and the changes fix this by removing the "File:" prefix from the data/files.json entries and reconstructing it in bot.ts when querying the API (using File:${file.wikiFileName}). This separation of concerns ensures filenames are stored cleanly in data while the prefix is applied consistently at query time, which should resolve the badfilename warning condition described in the linked issue.
Out of Scope Changes Check ✅ Passed All changes in the PR are directly related to the linked issue #55 and the PR's stated objective. The modifications to bot.ts and data/files.json both address the namespace prefix handling required to fix the badfilename warning. The summary indicates no exported/public API changes were made, and no alterations appear to extend beyond the scope of handling file namespace prefixes. There are no unrelated or extraneous changes present in this changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch development

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0926cb1 and 15a97a9.

📒 Files selected for processing (2)
  • bot.ts (2 hunks)
  • data/files.json (1 hunks)
🔇 Additional comments (4)
data/files.json (1)

1-38: LGTM! Consistent removal of namespace prefix.

All nine entries have been correctly updated to remove the "File:" namespace prefix from wikiFileName. This change aligns with the bot.ts updates that now add the prefix conditionally during API queries while using the bare filename for uploads.

bot.ts (3)

129-136: LGTM! Correct namespace prefix handling for query.

The query construction correctly adds the "File:" namespace prefix when fetching imageinfo from the MediaWiki API, which is required for the titles parameter.


147-150: LGTM! Consistent log message formatting.

The log message correctly adds "File " prefix for readability, maintaining consistency with the query usage while keeping the stored data clean.


160-168: I need to search more specifically for the mwn npm package documentation. Let me do that:

Based on my web search verification of the MediaWiki API documentation, I can confirm that the upload API accepts a bare filename parameter (e.g., "Sandboxfile1.jpg") without namespace prefixes. This validation supports the code changes shown in the review comment.

Verify that the upload method accepts filename without namespace prefix — Approved.

The fix is correct: the bot.upload() method now receives file.wikiFileName without the "File:" prefix, which aligns with MediaWiki API expectations. The MediaWiki API upload endpoint expects bare filenames, so this change should resolve the badfilename warning.


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.

@SomeMWDev SomeMWDev merged commit 0256625 into main Oct 24, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in IRWA Templates Taskboard Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Fix badfilename warning

1 participant