Skip to content

Conversation

itslenny
Copy link
Contributor

@itslenny itslenny commented Oct 6, 2025

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Many objects are indexed by web crawlers as there are no x-robot-tag headers

What is the new behavior?

  • Add default x-robots-tag: none header to prevent search engines from indexing / following
  • Add ability to specify custom x-robots-tag header when uploading objects
  • Use x-robots-tag value specified in object metadata in headers when serving files
  • Fix eslint warnings in edited files

Additional context

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Robots-Tag

@coveralls
Copy link

coveralls commented Oct 6, 2025

Pull Request Test Coverage Report for Build 18384716116

Details

  • 179 of 253 (70.75%) changed or added relevant lines in 13 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 76.329%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/http/routes/object/getObject.ts 3 7 42.86%
src/http/routes/object/getPublicObject.ts 1 6 16.67%
src/storage/validators/x-robots-tag.ts 123 188 65.43%
Totals Coverage Status
Change from base Build 18352064985: -0.04%
Covered Lines: 21348
Relevant Lines: 27738

💛 - Coveralls

@itslenny itslenny force-pushed the fix/add-robots-header branch from c7c81ec to 5970c63 Compare October 7, 2025 22:39
@itslenny itslenny force-pushed the fix/add-robots-header branch from 5970c63 to 98440df Compare October 7, 2025 22:51
request.signal
)

if (request.file.xRobotsTag) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should start adding strict validation for these headers.
Let's start adding the validation for the x-robot-tags

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added validation to where the values are stored via API and before applying the header to our responses. So, we won't serve a file with an invalid header in the case an invalid value was set in the DB directly (bypassing the API check).

@itslenny itslenny force-pushed the fix/add-robots-header branch from 7d741f8 to a019e9b Compare October 9, 2025 17:59
@itslenny itslenny requested a review from fenos October 9, 2025 18:02
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.

3 participants