Skip to content

Auto-enable conneg when mashlib is enabled - #127

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-22-mashlib-auto-conneg
Feb 24, 2026
Merged

Auto-enable conneg when mashlib is enabled#127
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-22-mashlib-auto-conneg

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Summary

  • When --mashlib or --mashlib-cdn is enabled, automatically set conneg: true
  • Mashlib expects .ttl files served as Turtle, but without conneg the raw JSON-LD is served, causing parse errors like Strange: Error parse_error trying to read your preference file

Change

One check added to loadConfig() in src/config.js (5 lines).

Test plan

  • jss start --mashlib-cdn now serves Turtle without needing explicit --conneg
  • Explicit --conneg still works independently

Closes #22

Mashlib expects .ttl files served as Turtle, but without --conneg
the raw JSON-LD is served causing parse errors. Now --mashlib or
--mashlib-cdn automatically sets conneg: true.

Closes #22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request automatically enables content negotiation (conneg) when Mashlib data browser is enabled via --mashlib or --mashlib-cdn flags. This addresses a usability issue where Mashlib would fail with parse errors when trying to read .ttl files that were served as raw JSON-LD instead of being converted to Turtle format through content negotiation.

Changes:

  • Auto-enable conneg: true when mashlib or mashlibCdn is enabled in configuration loading
  • Eliminates the need for users to manually specify both --mashlib-cdn --conneg flags
  • Prevents parse errors in Mashlib that occur when Turtle files are served as JSON-LD

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/config.js
Comment on lines +232 to +234
if (config.mashlib || config.mashlibCdn) {
config.conneg = true;
}

Copilot AI Feb 24, 2026

Copy link

Choose a reason for hiding this comment

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

This unconditionally overrides explicit user settings for conneg. If a user explicitly sets --conneg=false, JSS_CONNEG=false, or "conneg": false in their config file, this code will override their choice. The auto-enable logic should only apply when conneg hasn't been explicitly configured by the user. Consider checking if conneg was explicitly set in cliOptions, envConfig, or fileConfig before auto-enabling it, or at minimum only enable it when the merged value is still false (the default).

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. In this case, --mashlib without conneg is a broken combination — mashlib requires Turtle content negotiation to function. Serving .ttl files as raw JSON-LD always causes parse errors.

This is an implicit dependency, similar to how --ssl-cert requires --ssl-key. There's no valid use case for --mashlib --no-conneg, so auto-enabling is the correct behavior.

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

@melvincarvalho I've opened a new pull request, #128, to work on those changes. Once the pull request is ready, I'll request review from you.

@melvincarvalho
melvincarvalho merged commit 3142256 into gh-pages Feb 24, 2026
4 checks passed
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.

--mashlib should auto-enable --conneg

3 participants