File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
package sync
2
2
3
3
import (
4
- "bytes"
5
4
"context"
6
5
"encoding/json"
7
6
"fmt"
8
7
"io"
8
+ "reflect"
9
9
"strings"
10
10
11
11
"github.com/AliyunContainerService/image-syncer/pkg/utils/auth"
@@ -214,11 +214,16 @@ func (i *ImageDestination) String() string {
214
214
}
215
215
216
216
func manifestEqual (m1 , m2 []byte ) bool {
217
- var a bytes. Buffer
218
- _ = json . Compact ( & a , m1 )
217
+ var a map [ string ] interface {}
218
+ var b map [ string ] interface {}
219
219
220
- var b bytes.Buffer
221
- _ = json .Compact (& b , m2 )
220
+ if err := json .Unmarshal (m1 , & a ); err != nil {
221
+ //Received an unexpected manifest retrieval result, return false to trigger a fallback to the push task.
222
+ return false
223
+ }
224
+ if err := json .Unmarshal (m2 , & b ); err != nil {
225
+ return false
226
+ }
222
227
223
- return a . String () == b . String ( )
228
+ return reflect . DeepEqual ( a , b )
224
229
}
You can’t perform that action at this time.
0 commit comments