Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Prevent getPublicStaticResourceUri from crashing in cli con… #3314

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Feb 12, 2024

…text

Resolves: neos/neos-development-collection#4888

Related: #2157

Currently, if a no absolute baseUri is set the BaseUriProvider::getConfiguredBaseUriOrFallbackToCurrentRequest will throw an exception.

No base URI could be provided. This probably means a call was made outside of an HTTP request and a base
URI was neither configured nor specified as $fallbackRequest.

This makes it nearly* impossible to render resource paths in cli

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

…text

Currently, if a no absolute baseUri is set the `BaseUriProvider::getConfiguredBaseUriOrFallbackToCurrentRequest` will throw an exception.

> No base URI could be provided. This probably means a call was made outside of an HTTP request and a base
  URI was neither configured nor specified as $fallbackRequest.

This makes it nearly* impossible to render resource paths in cli
@bwaidelich
Copy link
Member

IMO it's a dangerous approach to silently convert the exception since.
Instead we should IMO throw if the absoluteBaseUri is not set and make sure that it is on the "outside"..

Related: #2157

@mhsdesign
Copy link
Member Author

Yes i outlined a possible approach that could work for Flow 9 in #3334 and am willing to close this.

@mhsdesign
Copy link
Member Author

i dont think how we could archive this?

make sure that it (the absoluteBaseUri) is set on the "outside".

the only way to set it is via this 😂

ObjectAccess::setProperty($this->baseUriProvider, "configuredBaseUri", 'http://localhost:8080', true);

thats why i proposed a refactoring in: #3334

but ill close this here, lets continue the discussion over there.

@mhsdesign mhsdesign closed this Mar 29, 2024
@bwaidelich
Copy link
Member

It's an option of the target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants