Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions agent/app/service/website.go
Original file line number Diff line number Diff line change
Expand Up @@ -2618,19 +2618,13 @@ func (w WebsiteService) GetRedirect(id uint) (res []response.NginxRedirectConfig
func (w WebsiteService) UpdateRedirectFile(req request.NginxRedirectUpdate) (err error) {
var (
website model.Website
nginxFull dto.NginxFull
oldRewriteContent []byte
)
website, err = websiteRepo.GetFirst(repo.WithByID(req.WebsiteID))
if err != nil {
return err
}
nginxFull, err = getNginxFull(&website)
if err != nil {
return err
}
includePath := fmt.Sprintf("/www/sites/%s/redirect/%s.conf", website.Alias, req.Name)
absolutePath := path.Join(nginxFull.Install.GetPath(), includePath)
absolutePath := path.Join(GetSitePath(website, SiteRedirectDir), req.Name+".conf")
fileOp := files.NewFileOp()
oldRewriteContent, err = fileOp.GetContent(absolutePath)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There do not appear to be any significant issues with this code. Please ensure that you have updated all dependencies and packages since the last run.

Additionally, consider implementing a more robust error handling strategy within your function calls such as using return points inside functions when something goes wrong instead of returning falsey values like nil, which is often left undefined and can cause confusion. This approach will make your code clearer and easier to understand.

Expand Down
Loading