Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanis Altherr <jaltherr@gitlab.com>2021-12-02 14:02:14 +0300
committerJanis Altherr <jaltherr@gitlab.com>2021-12-02 14:02:14 +0300
commit810fd5987a636c201144d9ff3fd017718d68b48e (patch)
tree7e19de2577efa911c216236b4b3aab7994f933c8
parenta80fdd4bc37ab2521ac90a741d9254335ec91ac3 (diff)
-rw-r--r--internal/vfs/zip/archive.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go
index 8bbfaf8e..b37751ed 100644
--- a/internal/vfs/zip/archive.go
+++ b/internal/vfs/zip/archive.go
@@ -205,18 +205,23 @@ func (a *zipArchive) getAllRootDirectories() []string {
}
func (a *zipArchive) guessPublicDirectoryName() string {
+ rootDirectories := a.getAllRootDirectories()
+
+ // If there's only one directory, use that, no matter what
+ if len(rootDirectories) == 1 {
+ return rootDirectories[0]
+ }
+
+ // If there's multiple directories, perform an educated guess
+ // as to which is the public folder based on its name
commonPrefixes := []string{
- // A slice of folder names used by popular SSG Frameworks
+ // Folder names used by popular SSG Frameworks
"public", // previous GitLab behaviour, Hugo, Gatsby, Svelte
// Non-default folder names, ordered by popularity
"build", // React
"dist", // Vue, Nuxt.js, Angular, Astro, Vite
"out", // Next.js
- "_site", // Eleventy
- }
- rootDirectories := a.getAllRootDirectories()
- if len(rootDirectories) == 1 {
- return rootDirectories[0]
+ "_site", // Eleventy, Jekyll
}
for _, pref := range commonPrefixes {
if sliceContains(rootDirectories, pref) {