Skip to content

Asset Not Found Handling in SwaggerAssetController #646

Description

@LeonardD93

When Swagger UI tries to fetch .map files (like swagger-ui.css.map) and they are missing from the vendor package, the current implementation throws a FileNotFoundException due to Filesystem::get('').

Suggestion: Add a simple check before loading the asset:

...
try {
      $path = swagger_ui_dist_path($documentation, $asset);

      if (empty($path) || !$fileSystem->exists($path)) {
          \Log::warning('[SwaggerAsset] Asset not found: ' . $asset);
          abort(404, 'Asset not found');
      }
...

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions