Skip to content

Fix infinite duplication bugs in subprojects.rb plugin#831

Open
praaatap wants to merge 1 commit intoprecice:masterfrom
praaatap:fix/subproject-plugin
Open

Fix infinite duplication bugs in subprojects.rb plugin#831
praaatap wants to merge 1 commit intoprecice:masterfrom
praaatap:fix/subproject-plugin

Conversation

@praaatap
Copy link
Contributor

@praaatap praaatap commented Mar 4, 2026

Description

This PR fixes two mistakes in the [_plugins/subprojects.rb] Jekyll plugin. These mistakes caused file filtering and endless asset duplication.

1. Correct Path Context for Directory Filtering

The plugin checked if a file is a directory using File.directory?(f).. Fis just the filename, likelogo.pngnot the full path. So Ruby checked the project root of theimages` subdirectory.

  • Fix: I used File.join(images, f) to give the path.

2. Fixed Infinite Duplication in Static Files

The code that tried to skip existing files did not work. The existing_statics Set had paths without a leading slash. The code checked against static_file.relative_path which has a leading slash. This meant the same files were re-registered in every build loop.

  • Fix: I added .delete_prefix('/') to the comparison so both paths match.

Impact

  • Prevents "Endless Rebuild Loops": Now Jekyll correctly identifies existing files and stops re-registering and re-writing the same assets.

  • ** Performance**: We save memory and time by not processing the same assets multiple times.

Verification

  • I checked that the Ruby syntax is correct.

  • I confirmed that path comparisons now consistently exclude the leading slash, for matching.

@praaatap praaatap changed the title Fix path logic and infinite duplication bugs in subprojects.rb plugin Fix infinite duplication bugs in subprojects.rb plugin Mar 4, 2026
@MakisH MakisH added GSoC Contributed in the context of the Google Summer of Code technical Technical issues on the website labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Contributed in the context of the Google Summer of Code technical Technical issues on the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants