Avatars not working when loaded from AD's `thumbnailphoto`:

thumbnailPhoto is binary and it can be saved as
```
PowerShell > [System.IO.File]::WriteAllBytes('C:\2\phpto.jpg', @(Get-ADUser ADFilimonov -properties 'thumbnailPhoto' ).thumbnailPhoto)
```

Photo has JPEG signature:
```
PowerShell > @(@(Get-ADUser ADFilimonov -properties 'thumbnailPhoto' ).thumbnailPhoto | Select-Object -First 32 | ForEach-Object { return "0x" + [System.Convert]::ToString($_, 16).padLeft(2,'0') } ) -join ', ' # 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x08, 0x06, 0x06, 0x07, 0x06, 0x05, 0x08
```

Sogo gives 404 when requesting photo on url
```
https://hostname/SOGo/so/jRQC6RGe_t1BW.2138IhNw--/Contacts/personal/12D-69D92F00-15-1D536080/photo
(IDK why it is in "personal" contacts)
```

And in logs it is
```
Apr 10 20:11:02 sogod [34]: 10.64.205.140 "GET /SOGo/so/jRQC6RGe_t1BW.2138IhNw--/Contacts/personal/12D-69D92F00-15-1D536080/photo HTTP/1.1" 404 208/0 0.008 - - 0 - 13
```

This is (shortened) config
```
SOGoUserSources = (
    {
      IDFieldName = objectGUID;
      IMAPLoginFieldName = mail;
      displayName = "AD.AUTH";
      filter = "(mail=\"*\")";
      hostname = "ldap://sogo.ldap.outproxy.internal:1389";;
      id = "sogo.ldap.outproxy.internal:1389";
      isAddressBook = 1;
      listRequiresDot = 1;
      mapping = {
        photo = (
          thumbnailPhoto,
        );
      };
      scope = SUB;
      type = ldap;
    };
  );
}
```

Reply via email to