Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Adds a new /enterprise-version endpoint that returns the $enterpriseVersion value from config.php in JSON format.

Implementation

  • Route handler: Checks PATH_INFO for /enterprise-version and exits early before existing update logic
  • Version extraction: Parses config file content with regex to avoid undefined variable errors from direct inclusion
  • Error handling: Returns HTTP 500 with error JSON if config file unreadable; uses JSON_THROW_ON_ERROR flag
  • Headers: Sets JSON content-type and standard security headers (X-XSS-Protection, X-Content-Type-Options, etc.)

Example Response

$ curl https://example.com/enterprise-version
{"enterpriseVersion":"3.17.4"}

The regex pattern [^'"\r\n]+ ensures version extraction stays within a single line, preventing multiline matches if config format changes.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/sebastianbergmann/global-state/zipball/800689427e3e8cf57a8fe38fcd1d4344c9b2f046
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ac5b293dba925751b808e02923399fb44ff0d541
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1d439c229e61f244ff1f211e5c99737f90c67def
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/q2Qhoa /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/8fe7e75986a9d24b4cceae847314035df7703a5a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/72a7f7674d053d548003b16ff5a106e7e0e06eee
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/18f071c3a29892b037d35e6b20ddf3ea39b42874
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/w1mHXv /usr/bin/composer install --no-interaction (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I need a new endpoint that just returns the value of $enterpriseVersion of config.php in json format


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 11, 2025 03:38
Co-authored-by: Rello <13385119+Rello@users.noreply.github.com>
Co-authored-by: Rello <13385119+Rello@users.noreply.github.com>
@Rello Rello requested a review from mgallien December 11, 2025 03:43
@Rello
Copy link
Collaborator

Rello commented Dec 11, 2025

@mgallien

this would add a new path for the endpoint: /enterprise-version

the current url scheme is:

https://updates.nextcloud.org/client/?version=4.0.50.20251204&platform=win32&osRelease=windows&osVersion=11&kernelVersion=10.0.26200&oem=Nextcloud&buildArch=x86_64¤tArch=x86_64&versionsuffix=daily&channel=daily&msi=true

do you know if this would work from the webserver if a client would request the url

https://updates.nextcloud.org/client/enterprise-version

Copilot AI changed the title [WIP] Add endpoint to return enterprise version in JSON format Add /enterprise-version endpoint to return enterprise version as JSON Dec 11, 2025
Copilot AI requested a review from Rello December 11, 2025 03:46
@Rello Rello marked this pull request as ready for review December 11, 2025 07:59
@mgallien
Copy link
Collaborator

@mgallien

this would add a new path for the endpoint: /enterprise-version

the current url scheme is:

https://updates.nextcloud.org/client/?version=4.0.50.20251204&platform=win32&osRelease=windows&osVersion=11&kernelVersion=10.0.26200&oem=Nextcloud&buildArch=x86_64¤tArch=x86_64&versionsuffix=daily&channel=daily&msi=true

do you know if this would work from the webserver if a client would request the url

https://updates.nextcloud.org/client/enterprise-version

I think this should work just fine
currently if you try the new route, you end-up with an empty xml reply
from the changes it looks like that would be just fine

@mgallien mgallien merged commit cfb4b8f into master Dec 11, 2025
5 checks passed
@mgallien mgallien deleted the copilot/add-enterprise-version-endpoint branch December 11, 2025 08:20
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