I am trying to download a file with this module enabled using the file entity module field formatter and I get this error. I tried to debug, but I don't see where this would be the case.

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to xmlsitemap_file_transfer() must be an instance of Symfony\Component\HttpFoundation\Response, string given in xmlsitemap_file_transfer() (line 2222 of modules/contrib/xmlsitemap/xmlsitemap.module).

xmlsitemap_file_transfer('public://2017-04/Vertical_City_Black_0.jpg', Array)
call_user_func_array('xmlsitemap_file_transfer', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('file_transfer', Array) (Line: 79)
Drupal\file_entity\Controller\FileController->download(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

diggingrelic created an issue. See original summary.

Chewie’s picture

Dave Reid’s picture

Title: xmlsitemap_file_transfer invalid argument » xmlsitemap_file_transfer conflicts with file_entity's hook_file_transfer()
Issue tags: -file download

Hrm, let's figure out if we can find something that works without having to rename a "public" function in our module.

Dave Reid’s picture

Dave Reid’s picture

Dave Reid’s picture

I ended up merging what I had intended to do with #3006887: Convert xmlsitemap_output_file() and xmlsitemap_transfer_file() to a Response object with this effort. I'd rather get this fixed properly and remove a hook conflict function earlier rather than later.

Dave Reid’s picture

I drafted two change notices about these xmlsitemap_file_transfer() being removed, and xmlsitemap_output_file() being deprecated

Status: Needs review » Needs work

The last submitted patch, 6: 2869214-hook-file-transfer-conflict.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Dave Reid’s picture

Status: Needs work » Needs review
FileSize
10.59 KB

This time without the irrelevant patch section.

  • Dave Reid committed 55ac401 on 8.x-1.x
    Issue #2869214 by Dave Reid, Chewie: Removed xmlsitemap_file_transfer()...
Dave Reid’s picture

Status: Needs review » Fixed
Issue tags: +Needs tests

Committed #9 to 8.x-1.x, but I'm filing a follow-up issue because we could really use some kernel tests around the cache handling and headers in the sitemap response.

Dave Reid’s picture

Change records have been published as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.