mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Fixed error when GitBucketHome/repositories does not exist.
This commit is contained in:
@@ -12,9 +12,14 @@ object Directory {
|
|||||||
/**
|
/**
|
||||||
* Repository names of the specified user.
|
* Repository names of the specified user.
|
||||||
*/
|
*/
|
||||||
def getRepositories(owner: String): List[String] =
|
def getRepositories(owner: String): List[String] = {
|
||||||
new File("%s/repositories/%s".format(GitBucketHome, owner))
|
val dir = new File("%s/repositories/%s".format(GitBucketHome, owner))
|
||||||
.listFiles.filter(_.isDirectory).map(_.getName.replaceFirst("\\.git$", "")).toList
|
if(dir.exists){
|
||||||
|
dir.listFiles.filter(_.isDirectory).map(_.getName.replaceFirst("\\.git$", "")).toList
|
||||||
|
} else {
|
||||||
|
Nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Substance directory of the repository.
|
* Substance directory of the repository.
|
||||||
|
|||||||
Reference in New Issue
Block a user