fix mirror crash if source is deleted (#3206)
This commit is contained in:
+12
-1
@@ -629,8 +629,19 @@ func (c *S3Client) notificationToEventsInfo(ninfo minio.NotificationInfo) []Even
|
||||
var eventsInfo = make([]EventInfo, len(ninfo.Records))
|
||||
for i, record := range ninfo.Records {
|
||||
bucketName := record.S3.Bucket.Name
|
||||
var key string
|
||||
// Unescape only if needed, look for URL encoded content.
|
||||
if strings.Contains(record.S3.Object.Key, "%2F") {
|
||||
var e error
|
||||
key, e = url.QueryUnescape(record.S3.Object.Key)
|
||||
if e != nil {
|
||||
key = record.S3.Object.Key
|
||||
}
|
||||
} else {
|
||||
key = record.S3.Object.Key
|
||||
}
|
||||
u := c.targetURL.Clone()
|
||||
u.Path = path.Join(string(u.Separator), bucketName, record.S3.Object.Key)
|
||||
u.Path = path.Join(string(u.Separator), bucketName, key)
|
||||
if strings.HasPrefix(record.EventName, "s3:ObjectCreated:") {
|
||||
if strings.HasPrefix(record.EventName, "s3:ObjectCreated:Copy") {
|
||||
eventsInfo[i] = EventInfo{
|
||||
|
||||
@@ -227,7 +227,7 @@ func getSourceStream(alias string, urlStr string, fetchStat bool, sse encrypt.Se
|
||||
if mok {
|
||||
oinfo, e := mo.Stat()
|
||||
if e != nil {
|
||||
return nil, nil, err.Trace(alias, urlStr)
|
||||
return nil, nil, probe.NewError(e).Trace(alias, urlStr)
|
||||
}
|
||||
st = &ClientContent{}
|
||||
st.Time = oinfo.LastModified
|
||||
|
||||
Reference in New Issue
Block a user