"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "routers/routes/routes.go" between
gitea-1.13.1.tar.gz and gitea-1.13.2.tar.gz

About: Gitea allows to set up a self-hosted code hosting Git service (a fork of Gogs).

routes.go  (gitea-1.13.1):routes.go  (gitea-1.13.2)
skipping to change at line 124 skipping to change at line 124
} }
func storageHandler(storageSetting setting.Storage, prefix string, objStore stor age.ObjectStorage) macaron.Handler { func storageHandler(storageSetting setting.Storage, prefix string, objStore stor age.ObjectStorage) macaron.Handler {
if storageSetting.ServeDirect { if storageSetting.ServeDirect {
return func(ctx *macaron.Context) { return func(ctx *macaron.Context) {
req := ctx.Req.Request req := ctx.Req.Request
if req.Method != "GET" && req.Method != "HEAD" { if req.Method != "GET" && req.Method != "HEAD" {
return return
} }
if !strings.HasPrefix(req.RequestURI, "/"+prefix) { if !strings.HasPrefix(req.URL.RequestURI(), "/"+prefix) {
return return
} }
rPath := strings.TrimPrefix(req.RequestURI, "/"+prefix) rPath := strings.TrimPrefix(req.URL.RequestURI(), "/"+pre fix)
u, err := objStore.URL(rPath, path.Base(rPath)) u, err := objStore.URL(rPath, path.Base(rPath))
if err != nil { if err != nil {
if os.IsNotExist(err) || errors.Is(err, os.ErrNot Exist) { if os.IsNotExist(err) || errors.Is(err, os.ErrNot Exist) {
log.Warn("Unable to find %s %s", prefix, rPath) log.Warn("Unable to find %s %s", prefix, rPath)
ctx.Error(404, "file not found") ctx.Error(404, "file not found")
return return
} }
log.Error("Error whilst getting URL for %s %s. Er ror: %v", prefix, rPath, err) log.Error("Error whilst getting URL for %s %s. Er ror: %v", prefix, rPath, err)
ctx.Error(500, fmt.Sprintf("Error whilst getting URL for %s %s", prefix, rPath)) ctx.Error(500, fmt.Sprintf("Error whilst getting URL for %s %s", prefix, rPath))
return return
skipping to change at line 155 skipping to change at line 155
) )
} }
} }
return func(ctx *macaron.Context) { return func(ctx *macaron.Context) {
req := ctx.Req.Request req := ctx.Req.Request
if req.Method != "GET" && req.Method != "HEAD" { if req.Method != "GET" && req.Method != "HEAD" {
return return
} }
if !strings.HasPrefix(req.RequestURI, "/"+prefix) { if !strings.HasPrefix(req.URL.RequestURI(), "/"+prefix) {
return return
} }
rPath := strings.TrimPrefix(req.RequestURI, "/"+prefix) rPath := strings.TrimPrefix(req.URL.RequestURI(), "/"+prefix)
rPath = strings.TrimPrefix(rPath, "/") rPath = strings.TrimPrefix(rPath, "/")
//If we have matched and access to release or issue //If we have matched and access to release or issue
fr, err := objStore.Open(rPath) fr, err := objStore.Open(rPath)
if err != nil { if err != nil {
if os.IsNotExist(err) || errors.Is(err, os.ErrNotExist) { if os.IsNotExist(err) || errors.Is(err, os.ErrNotExist) {
log.Warn("Unable to find %s %s", prefix, rPath) log.Warn("Unable to find %s %s", prefix, rPath)
ctx.Error(404, "file not found") ctx.Error(404, "file not found")
return return
} }
log.Error("Error whilst opening %s %s. Error: %v", prefix , rPath, err) log.Error("Error whilst opening %s %s. Error: %v", prefix , rPath, err)
skipping to change at line 250 skipping to change at line 250
for _, name := range localeNames { for _, name := range localeNames {
localFiles[name], err = options.Locale(name) localFiles[name], err = options.Locale(name)
if err != nil { if err != nil {
log.Fatal("Failed to load %s locale file. %v", name, err) log.Fatal("Failed to load %s locale file. %v", name, err)
} }
} }
m.Use(i18n.I18n(i18n.Options{ m.Use(i18n.I18n(i18n.Options{
SubURL: setting.AppSubURL, SubURL: setting.AppSubURL,
Files: localFiles, Files: localFiles,
Langs: setting.Langs, Langs: setting.Langs,
Names: setting.Names, Names: setting.Names,
DefaultLang: "en-US", DefaultLang: "en-US",
Redirect: false, Redirect: false,
CookieDomain: setting.SessionConfig.Domain, CookieHttpOnly: true,
Secure: setting.SessionConfig.Secure,
CookieDomain: setting.SessionConfig.Domain,
})) }))
m.Use(cache.Cacher(cache.Options{ m.Use(cache.Cacher(cache.Options{
Adapter: setting.CacheService.Adapter, Adapter: setting.CacheService.Adapter,
AdapterConfig: setting.CacheService.Conn, AdapterConfig: setting.CacheService.Conn,
Interval: setting.CacheService.Interval, Interval: setting.CacheService.Interval,
})) }))
m.Use(captcha.Captchaer(captcha.Options{ m.Use(captcha.Captchaer(captcha.Options{
SubURL: setting.AppSubURL, SubURL: setting.AppSubURL,
})) }))
m.Use(session.Sessioner(session.Options{ m.Use(session.Sessioner(session.Options{
 End of changes. 5 change blocks. 
11 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)