Skip to content

Commit daffab4

Browse files
ek23josteink
authored andcommitted
Attachment URLs not working for non-primary gmail accounts (KartikTalwar#577)
* Attachment URLs not working for non-primary gmail accounts
1 parent 2a3c264 commit daffab4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/gmail.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ var Gmail = function(localJQuery) {
12381238
attachment_id: item["1"]["2"],
12391239
name: data["3"],
12401240
type: data["4"],
1241-
url: data["2"],
1241+
url: api.tools.check_fd_attachment_url(data["2"]),
12421242
size: Number.parseInt(data["5"])
12431243
});
12441244
}
@@ -1247,6 +1247,15 @@ var Gmail = function(localJQuery) {
12471247
return res;
12481248
};
12491249

1250+
api.tools.check_fd_attachment_url = function(url) {
1251+
var userAccountUrlPart = api.tracker.globals[7];
1252+
if (url && userAccountUrlPart && url.indexOf(userAccountUrlPart) < 0) {
1253+
url = url.replace('/mail/?', userAccountUrlPart + '?');
1254+
}
1255+
1256+
return url;
1257+
};
1258+
12501259
api.tools.parse_fd_request_html_payload = function(fd_email) {
12511260
let fd_email_content_html = null;
12521261
try {

0 commit comments

Comments
 (0)