Skip to content

Commit acc99b3

Browse files
committed
fix: catch error when trying to get original file from github
Refs #118
1 parent e8fcd0c commit acc99b3

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/Controller/ShopwareFilesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private function getShopwareUrl(string $name): ?string
122122

123123
private function getOriginalFileContent(string $name): ?string
124124
{
125-
return file_get_contents($this->getShopwareUrl($name) . '?raw=true');
125+
return @file_get_contents($this->getShopwareUrl($name) . '?raw=true') ?: null;
126126
}
127127

128128
private function isIgnoredFileHash(string $file, string $md5Sum): bool

src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/template.twig

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
:columns="columns">
1818

1919
<template #actions="{ item }">
20-
<sw-context-menu-item @click="openUrl(item.shopwareUrl)">
21-
{{ $tc('frosh-tools.tabs.files.openOriginal') }}
22-
</sw-context-menu-item>
23-
<sw-context-menu-item @click="diff(item.name, item.content, item.originalContent)">
24-
{{ $tc('frosh-tools.tabs.files.restore.diff') }}
25-
</sw-context-menu-item>
20+
<template v-if="item.originalContent">
21+
<sw-context-menu-item @click="openUrl(item.shopwareUrl)">
22+
{{ $tc('frosh-tools.tabs.files.openOriginal') }}
23+
</sw-context-menu-item>
24+
<sw-context-menu-item @click="diff(item.name, item.content, item.originalContent)">
25+
{{ $tc('frosh-tools.tabs.files.restore.diff') }}
26+
</sw-context-menu-item>
27+
</template>
2628
</template>
2729
</sw-data-grid>
2830
</sw-card>

src/Resources/public/administration/js/frosh-tools.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)