admin: Fix check file on disk for compressed files
This commit is contained in:
parent
407b67f4c2
commit
24686a6a24
@ -30,13 +30,13 @@
|
|||||||
<div class="spinner-border spinner-border-sm" role="status" ng-if="file.gunzipWIP"></div>
|
<div class="spinner-border spinner-border-sm" role="status" ng-if="file.gunzipWIP"></div>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td ng-repeat="field in fields">
|
<td ng-repeat="field in fields" class="text-truncate" style="max-width: 30vw" title="{{ file[field] }}">
|
||||||
{{ file[field] }}
|
{{ file[field] }}
|
||||||
<span ng-if="field == 'id' && file.err !== undefined && file.err !== true" title="{{ file.err }}" class="glyphicon glyphicon-exclamation-sign"></span>
|
<span ng-if="field == 'id' && file.err !== undefined && file.err !== true" title="{{ file.err }}" class="glyphicon glyphicon-exclamation-sign"></span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style="max-width: 100px">
|
||||||
{{ file.checksum | bto16 }}
|
<div class="text-truncate" title="{{ file.checksum | bto16 }}">{{ file.checksum | bto16 }}</div>
|
||||||
<div ng-if="file.checksum_shown">{{ file.checksum_shown | bto16 }}</div>
|
<div class="text-truncate" ng-if="file.checksum_shown" title="{{ file.checksum_shown | bto16 }}">{{ file.checksum_shown | bto16 }}</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -392,7 +392,12 @@ func (f *EFile) GetDepends() ([]Flag, error) {
|
|||||||
|
|
||||||
// CheckFileOnDisk recalculates the hash of the file on disk.
|
// CheckFileOnDisk recalculates the hash of the file on disk.
|
||||||
func (f *EFile) CheckFileOnDisk() error {
|
func (f *EFile) CheckFileOnDisk() error {
|
||||||
if _, size, err := checkFileHash(path.Join(FilesDir, f.Path), f.Checksum); err != nil {
|
firstChecksum := f.Checksum
|
||||||
|
if len(f.ChecksumShown) > 0 {
|
||||||
|
firstChecksum = f.ChecksumShown
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, size, err := checkFileHash(path.Join(FilesDir, f.Path), firstChecksum); size > 0 && err != nil {
|
||||||
return err
|
return err
|
||||||
} else if size == 0 {
|
} else if size == 0 {
|
||||||
if _, _, err := checkFileHash(path.Join(FilesDir, f.Path+".gz"), f.Checksum); err != nil {
|
if _, _, err := checkFileHash(path.Join(FilesDir, f.Path+".gz"), f.Checksum); err != nil {
|
||||||
@ -400,9 +405,17 @@ func (f *EFile) CheckFileOnDisk() error {
|
|||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
} else {
|
} else if err != nil {
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(path.Join(FilesDir, f.Path+".gz")); !os.IsNotExist(err) {
|
||||||
|
if _, _, err = checkFileHash(path.Join(FilesDir, f.Path+".gz"), f.Checksum); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GunzipFileOnDisk gunzip a compressed file.
|
// GunzipFileOnDisk gunzip a compressed file.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user