mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:59:03 +00:00
Refactoring part 2.11: Long func refactoring in server and utils (#1083)
* Split long functions and optimize code * Addressing comments --------- Co-authored-by: Konstantin Koval
This commit is contained in:
@@ -56,7 +56,8 @@ func ApiEndpointUrl() *url.URL {
|
||||
|
||||
apiEndpointURL, err := url.Parse(apiEndpointStr)
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)", EnvAPIEndpoint.GetName(), EnvAPIEndpoint.GetValue())
|
||||
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)",
|
||||
EnvAPIEndpoint.GetName(), EnvAPIEndpoint.GetValue())
|
||||
}
|
||||
|
||||
if shouldServeUI {
|
||||
@@ -74,7 +75,8 @@ func UiEndpointUrl() *url.URL {
|
||||
|
||||
uiEndpointURL, err := url.Parse(EnvUIEndpoint.GetValue())
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)", EnvUIEndpoint.GetName(), EnvUIEndpoint.GetValue())
|
||||
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)",
|
||||
EnvUIEndpoint.GetName(), EnvUIEndpoint.GetValue())
|
||||
}
|
||||
|
||||
return uiEndpointURL
|
||||
|
||||
@@ -84,7 +84,8 @@ func IsDirSymlink(path string) (bool, error) {
|
||||
|
||||
resolvedFile, err := os.Stat(resolvedPath)
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "Cannot get fileinfo of linktarget %s of symlink %s, ignoring it", resolvedPath, path)
|
||||
return false, fmt.Errorf("Cannot get fileinfo of linktarget %s of symlink %s, ignoring it: %w",
|
||||
resolvedPath, path, err)
|
||||
}
|
||||
isDirSymlink = resolvedFile.IsDir()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user