mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Only warn on errors in deleting LFS orphaned files during repo deletion (#7213)
This commit is contained in:
		@@ -63,7 +63,7 @@ func RemoveAllWithNotice(title, path string) {
 | 
				
			|||||||
func removeAllWithNotice(e Engine, title, path string) {
 | 
					func removeAllWithNotice(e Engine, title, path string) {
 | 
				
			||||||
	if err := os.RemoveAll(path); err != nil {
 | 
						if err := os.RemoveAll(path); err != nil {
 | 
				
			||||||
		desc := fmt.Sprintf("%s [%s]: %v", title, path, err)
 | 
							desc := fmt.Sprintf("%s [%s]: %v", title, path, err)
 | 
				
			||||||
		log.Warn(desc)
 | 
							log.Warn(title+" [%s]: %v", path, err)
 | 
				
			||||||
		if err = createNotice(e, NoticeRepository, desc); err != nil {
 | 
							if err = createNotice(e, NoticeRepository, desc); err != nil {
 | 
				
			||||||
			log.Error("CreateRepositoryNotice: %v", err)
 | 
								log.Error("CreateRepositoryNotice: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1882,10 +1882,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		oidPath := filepath.Join(v.Oid[0:2], v.Oid[2:4], v.Oid[4:len(v.Oid)])
 | 
							oidPath := filepath.Join(v.Oid[0:2], v.Oid[2:4], v.Oid[4:len(v.Oid)])
 | 
				
			||||||
		err = os.Remove(filepath.Join(setting.LFS.ContentPath, oidPath))
 | 
							removeAllWithNotice(sess, "Delete orphaned LFS file", oidPath)
 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			return err
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if _, err := sess.Delete(&LFSMetaObject{RepositoryID: repoID}); err != nil {
 | 
						if _, err := sess.Delete(&LFSMetaObject{RepositoryID: repoID}); err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user