Skip to content

Instantly share code, notes, and snippets.

@garvinhicking
Created January 24, 2024 20:33
Show Gist options
  • Save garvinhicking/f95e94784a78db16100331e613ae72b0 to your computer and use it in GitHub Desktop.
Save garvinhicking/f95e94784a78db16100331e613ae72b0 to your computer and use it in GitHub Desktop.
TYPO3 ImportExport stripPathSitePrefix Patch
diff --git a/typo3/sysext/impexp/Classes/Export.php b/typo3/sysext/impexp/Classes/Export.php
index 54b4b63599..dd94d85749 100644
--- a/typo3/sysext/impexp/Classes/Export.php
+++ b/typo3/sysext/impexp/Classes/Export.php
@@ -1095,7 +1095,7 @@ class Export extends ImportExport
$fileInfo = [];
$fileInfo['filename'] = PathUtility::basename($fileData['ID_absFile']);
$fileInfo['filemtime'] = $fileStat['mtime'];
- $fileInfo['relFileRef'] = PathUtility::stripPathSitePrefix($fileData['ID_absFile']);
+ $fileInfo['relFileRef'] = PathUtility::stripPathSitePrefix((string)$fileData['ID_absFile'] ?? '');
if ($recordRef) {
$fileInfo['record_ref'] = $recordRef . '/' . $field;
}
diff --git a/typo3/sysext/impexp/Classes/Import.php b/typo3/sysext/impexp/Classes/Import.php
index db8908e6c5..99b91fdc3e 100644
--- a/typo3/sysext/impexp/Classes/Import.php
+++ b/typo3/sysext/impexp/Classes/Import.php
@@ -1670,7 +1670,7 @@ class Import extends ImportExport
// If the fileID map contains an entry for this fileID then just return the relative filename of that entry;
// we don't want to write another unique filename for this one!
if (isset($this->fileIdMap[$fileID])) {
- return PathUtility::stripPathSitePrefix($this->fileIdMap[$fileID]);
+ return PathUtility::stripPathSitePrefix((string)$this->fileIdMap[$fileID] ?? '');
}
// Verify FileMount access to dir-prefix. Returns the best alternative relative path if any
$dirPrefix = $this->resolveStoragePath($origDirPrefix);
diff --git a/typo3/sysext/impexp/Classes/ImportExport.php b/typo3/sysext/impexp/Classes/ImportExport.php
index bdf78cadda..be48bb93d5 100644
--- a/typo3/sysext/impexp/Classes/ImportExport.php
+++ b/typo3/sysext/impexp/Classes/ImportExport.php
@@ -791,7 +791,7 @@ abstract class ImportExport
->setTitle($line['ref'])
->render();
$line['title'] = htmlspecialchars($fileInfo['filename']) . ' <em>(Original)</em>';
- $line['showDiffContent'] = PathUtility::stripPathSitePrefix($this->fileIdMap[$ID]);
+ $line['showDiffContent'] = PathUtility::stripPathSitePrefix((string)$this->fileIdMap[$ID] ?? '');
$lines[] = $line;
unset($this->remainHeader['files'][$ID]);
}
@@ -816,7 +816,7 @@ abstract class ImportExport
->setTitle($line['ref'])
->render();
$line['title'] = htmlspecialchars($fileInfo['filename']) . ' <em>(Resource)</em>';
- $line['showDiffContent'] = PathUtility::stripPathSitePrefix($this->fileIdMap[$extID]);
+ $line['showDiffContent'] = PathUtility::stripPathSitePrefix((string)$this->fileIdMap[$extID] ?? '');
$lines[] = $line;
unset($this->remainHeader['files'][$extID]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment