forked from projects/file-explorer
Compare commits
No commits in common. "987e49cdec03431edea932d93ae2f99f76c0c1e1" and "b189753c1e86c25b0dbf22c672ac759a496d76ff" have entirely different histories.
987e49cdec
...
b189753c1e
@ -23,8 +23,7 @@
|
|||||||
"symfony/yaml": "7.1.*",
|
"symfony/yaml": "7.1.*",
|
||||||
"symfonycasts/tailwind-bundle": "^0.6.1",
|
"symfonycasts/tailwind-bundle": "^0.6.1",
|
||||||
"twig/extra-bundle": "^2.12|^3.0",
|
"twig/extra-bundle": "^2.12|^3.0",
|
||||||
"twig/twig": "^2.12|^3.0",
|
"twig/twig": "^2.12|^3.0"
|
||||||
"ext-fileinfo": "*"
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
|||||||
use App\Service\FileSystemService;
|
use App\Service\FileSystemService;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ readonly class DirContent
|
|||||||
private string $type,
|
private string $type,
|
||||||
private string $path,
|
private string $path,
|
||||||
private string $content,
|
private string $content,
|
||||||
private string $mimeType,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,8 +24,7 @@ readonly class DirContent
|
|||||||
$fileInfo->getSize() ?? 0,
|
$fileInfo->getSize() ?? 0,
|
||||||
$fileInfo->getType() ?? 'N/A',
|
$fileInfo->getType() ?? 'N/A',
|
||||||
$fileInfo->getPath(),
|
$fileInfo->getPath(),
|
||||||
$content,
|
$content
|
||||||
mime_content_type($fileInfo->getPath() . '/' . $fileInfo->getFilename()),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,11 +57,6 @@ readonly class DirContent
|
|||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMimeType(): string
|
|
||||||
{
|
|
||||||
return $this->mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getHumanReadableSize(): string
|
private function getHumanReadableSize(): string
|
||||||
{
|
{
|
||||||
$bytes = $this->size;
|
$bytes = $this->size;
|
||||||
|
@ -15,11 +15,7 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="mt-6 text-gray-700 overflow-auto max-h-96">
|
<div class="mt-6 text-gray-700 overflow-auto max-h-96">
|
||||||
{% if file.mimeType starts with 'image' %}
|
<p class="whitespace-pre-wrap leading-relaxed break-all text-balance">{{ file.content|raw }}</p>
|
||||||
<img src="{{ path('serve_file', {filePath: file.name}) }}" alt="">
|
|
||||||
{% else %}
|
|
||||||
<p class="whitespace-pre-wrap leading-relaxed break-all text-balance">{{ file.content|raw }}</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user