From 7d9ca3998e2d92221ee8bf568591356094031609 Mon Sep 17 00:00:00 2001
From: harry <me@harry.plus>
Date: Wed, 25 Mar 2020 19:08:50 +0530
Subject: [PATCH] drive: Extend --drive-stop-on-upload-limit to respond to
 teamDriveFileLimitExceeded.

Fixes #3979
---
 backend/drive/drive.go | 3 +++
 1 file changed, 3 insertions(+)
 mode change 100644 => 100755 backend/drive/drive.go

diff --git a/backend/drive/drive.go b/backend/drive/drive.go
old mode 100644
new mode 100755
index 928e089aa..4007d2056
--- a/backend/drive/drive.go
+++ b/backend/drive/drive.go
@@ -616,6 +616,9 @@ func (f *Fs) shouldRetry(err error) (bool, error) {
 					return false, fserrors.FatalError(err)
 				}
 				return true, err
+			} else if f.opt.StopOnUploadLimit && reason == "teamDriveFileLimitExceeded" {
+				fs.Errorf(f, "Received team drive file limit error: %v", err)
+				return false, fserrors.FatalError(err)
 			}
 		}
 	}