Skip to content
Snippets Groups Projects
Commit 1f698cd7 authored by Steinwender, Tamara's avatar Steinwender, Tamara
Browse files

Make linter happy

parent 4f934ef5
No related branches found
No related tags found
1 merge request!14Backup and rename to main
Pipeline #200608 failed
......@@ -4,9 +4,6 @@ declare(strict_types=1);
namespace Dbp\Relay\BlobConnectorFilesystemBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Dbp\Relay\BlobBundle\Entity\FileData;
/**
* @ORM\Entity
* @ORM\Table(name="blob_connector_filesystem")
......
......@@ -8,7 +8,7 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Create table blob_connector_local
* Create table blob_connector_local.
*/
final class Version20221024082730 extends AbstractMigration
{
......
......@@ -19,7 +19,6 @@ final class Version20221024095017 extends AbstractMigration
public function up(Schema $schema): void
{
}
public function down(Schema $schema): void
......
......@@ -42,7 +42,8 @@ class ConfigurationService
return $this->config['path'];
}
public function getLinkUrl(): string{
public function getLinkUrl(): string
{
return $this->config['linkUrl'];
}
......
......@@ -11,10 +11,10 @@ use Dbp\Relay\BlobBundle\Service\DatasystemProviderServiceInterface;
use Dbp\Relay\BlobConnectorFilesystemBundle\Entity\ShareLinkPersistence;
use Dbp\Relay\CoreBundle\Exception\ApiError;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\TextUI\XmlConfiguration\File;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\String\Slugger\SluggerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\String\Slugger\SluggerInterface;
use Symfony\Component\Uid\Uuid;
class FilesystemService implements DatasystemProviderServiceInterface
......@@ -29,7 +29,6 @@ class FilesystemService implements DatasystemProviderServiceInterface
*/
private $configurationService;
/**
* @var SluggerInterface
*/
......@@ -53,7 +52,6 @@ class FilesystemService implements DatasystemProviderServiceInterface
{
$shareLink = new ShareLinkPersistence();
/** @var ?UploadedFile $uploadedFile */
$uploadedFile = $fileData->getFile();
$folder = substr($fileData->getIdentifier(), 0, 2);
......@@ -61,11 +59,11 @@ class FilesystemService implements DatasystemProviderServiceInterface
$safeFilename = $this->slugger->slug($id);
$newFilename = $safeFilename.'.'.$uploadedFile->guessExtension();
$destination = $this->configurationService->getPath();
if (substr($destination, -1) != '/') {
if (substr($destination, -1) !== '/') {
$destination .= '/';
}
$destination .= $fileData->getBucket()->getPath();
if (substr($destination, -1) != '/') {
if (substr($destination, -1) !== '/') {
$destination .= '/';
}
$destination .= $folder;
......@@ -76,7 +74,6 @@ class FilesystemService implements DatasystemProviderServiceInterface
throw ApiError::withDetails(Response::HTTP_BAD_REQUEST, 'File could not be uploaded', 'blob-connector-filesystem:save-file-error');
}
/* Move File from images to copyImages folder*/
//generate link
......@@ -101,6 +98,7 @@ class FilesystemService implements DatasystemProviderServiceInterface
} catch (\Exception $e) {
throw ApiError::withDetails(Response::HTTP_INTERNAL_SERVER_ERROR, 'ShareLink could not be saved!', 'blob-connector-filesystem:sharelink-not-saved', ['message' => $e->getMessage()]);
}
return $fileData;
}
......@@ -132,6 +130,7 @@ class FilesystemService implements DatasystemProviderServiceInterface
private function generateContentUrl(string $id): string
{
$link = $this->configurationService->getLinkUrl();
return $link.'blob/'.$id;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment