yii2 action called twice




    public function actionDownload($id)

    {

        /** @var Usuario $usuario */

        $usuario = \Yii::$app->user->identity;

        $alunoRA = $usuario->aluno && $usuario->aluno->ra ? ["RA" => $usuario->aluno->ra] : [];

        \Yii::$app->logActivity->registerActivity("circular-download-arquivo", $alunoRA);

        /** @var CircularForm $circulares */

        $circulares = \Yii::createObject([

            'class' => CircularForm::className(),

            'id' => $id

        ]);

        $fileObj = $circulares->downloadAnexo();


        \Yii::$app->response->format = Response::FORMAT_RAW;

        \Yii::$app->response->headers->add('Content-Type', $fileObj->contentTypes);

        \Yii::$app->response->headers->add('Content-Disposition', 'inline');

        \Yii::$app->response->headers->add('filename', $fileObj->file);

        \Yii::$app->response->data = base64_decode($fileObj->fileByteArray);

        return \Yii::$app->response;

    }



this action always called twice and i not discovery what problem.

Edit:

I noticed that this happens when the file is a PDF, but when an image file does not.