From 62b9eda0c245efb86aa276231b38eac95d487ba5 Mon Sep 17 00:00:00 2001
From: Johannes Feustel <s@feustel.eu>
Date: Mon, 7 Oct 2013 01:04:20 +0200
Subject: [PATCH] [BUGFIX] EXT:documentation should accept other index file
 names

EXT:documentation checks for Index.html, index.html and index.htm as
main files for additional html documentations.

Change-Id: Idd2970ef9d6cc1b6f436b0c0fe0c607cf7b9d903
Resolves: #52569
Releases: 6.2
Reviewed-on: https://review.typo3.org/24441
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
---
 .../Classes/Domain/Repository/DocumentRepository.php  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/documentation/Classes/Domain/Repository/DocumentRepository.php b/typo3/sysext/documentation/Classes/Domain/Repository/DocumentRepository.php
index 057401f4c416..057064249fdb 100644
--- a/typo3/sysext/documentation/Classes/Domain/Repository/DocumentRepository.php
+++ b/typo3/sysext/documentation/Classes/Domain/Repository/DocumentRepository.php
@@ -165,7 +165,14 @@ class DocumentRepository {
 					$documentFile = '';
 					switch ($format) {
 						case 'html':
-							$documentFile = 'Index.html';
+							// Try to find a valid index file
+							$indexFiles = array('Index.html', 'index.html', 'index.htm');
+							foreach ($indexFiles as $indexFile) {
+								if (file_exists(PATH_site . $formatPath . $format . '/' . $indexFile)) {
+									$documentFile = $indexFile;
+									break;
+								}
+							}
 							break;
 						case 'pdf':
 							// Retrieve first PDF
@@ -175,7 +182,7 @@ class DocumentRepository {
 							}
 							break;
 					}
-					if (!empty($documentFile) && is_file(PATH_site . $formatPath . $format . '/' . $documentFile)) {
+					if (!empty($documentFile)) {
 						/** @var \TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $documentFormat */
 						$documentFormat = $this->objectManager->get('TYPO3\\CMS\\Documentation\\Domain\\Model\\DocumentFormat')
 							->setFormat($format)
-- 
GitLab