Bug: smugmug.images.delete fails against 1.1.0
luke_church
Registered Users Posts: 507 Major grins
Bug: smugmug.images.delete incorrectly fails with a Invalid User fault code on XML-RPC 1.1.0 but works correctly against XML-RPC 1.1.1 BETA
This is not the slave bug. The code makes a connection and goes into thread sleep for 15 seconds to ensure that the slaves are updated. Further it then runs an 'image query' against the image. This is tested to ensure it is being given priviledged information.
Once it has ensure that it has a priviledged status, it attempts a delete.
XML-RPC 1.1.0 fails with fault code 4: Invalid User and does not delete the image, XML-RPC 1.1.1 succeeds.
Sample code to reproduce (C#, SmugTools pre-Alpha library)
[php]
public static void Test_DeleteImage()
{
int imageID = 35891634; //35655858
SmugmugApi api = new SmugmugApi(emailAddress, password, transferLogFile, detailedLogFile);
ImageInfo info = api.GetImageInfo(imageID);
Debug.Assert(info.Watermark != null); //Assert I have permission to manipulate this image
api.DeleteImage(imageID);
//Negative test - Foreign image
bool exceptionCaught = false;
try
{
api.DeleteImage(5739903);
}
catch (SmugmugAccessException)
{
exceptionCaught = true;
}
Debug.Assert(exceptionCaught);
[/php]
XML from XML-RPC 1.1.0:
[php]
<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.images.getInfo</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<i4>35891634</i4>
</value>
</param>
</params>
</methodCall>
Header
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>AlbumID</name>
<value>
<int>804780</int>
</value>
</member>
<member>
<name>FileName</name>
<value>
<string>DSC06694.JPG</string>
</value>
</member>
<member>
<name>Caption</name>
<value>
<string/>
</value>
</member>
<member>
<name>Keywords</name>
<value>
<string/>
</value>
</member>
<member>
<name>Position</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>Date</name>
<value>
<string>2005-09-13 05:24:00</string>
</value>
</member>
<member>
<name>Format</name>
<value>
<string>JPG</string>
</value>
</member>
<member>
<name>Serial</name>
<value>
<int>0</int>
</value>
</member>
<member>
<name>Watermark</name>
<value>
<string>0</string>
</value>
</member>
<member>
<name>Size</name>
<value>
<int>2635816</int>
</value>
</member>
<member>
<name>Width</name>
<value>
<int>3264</int>
</value>
</member>
<member>
<name>Height</name>
<value>
<int>2448</int>
</value>
</member>
<member>
<name>MD5Sum</name>
<value>
<string>sm-2ee7298c1eb886b99fd4c5b00f2d4829-sm</string>
</value>
</member>
<member>
<name>LastUpdated</name>
<value>
<string>20050913052406</string>
</value>
</member>
<member>
<name>OriginalURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-O.jpg</string>
</value>
</member>
<member>
<name>LargeURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-L.jpg</string>
</value>
</member>
<member>
<name>MediumURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-M.jpg</string>
</value>
</member>
<member>
<name>SmallURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-S.jpg</string>
</value>
</member>
<member>
<name>TinyURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-Ti.jpg</string>
</value>
</member>
<member>
<name>ThumbURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-Th.jpg</string>
</value>
</member>
<member>
<name>AlbumURL</name>
<value>
<string>http://SmugTools.smugmug.com/gallery/804780/1/35891634</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
Header
<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.images.delete</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<i4>35891634</i4>
</value>
</param>
</params>
</methodCall>
Header
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>4</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string>invalid user</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
[/php]
Whereas the response to the delete request against XML-RPC 1.1.1 BETA
[php]
<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.images.delete</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<i4>35891634</i4>
</value>
</param>
</params>
</methodCall>
Header
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<string>SUCCESS</string>
</value>
</param>
</params>
</methodResponse>
[/php]
Cheers,
Luke
This is not the slave bug. The code makes a connection and goes into thread sleep for 15 seconds to ensure that the slaves are updated. Further it then runs an 'image query' against the image. This is tested to ensure it is being given priviledged information.
Once it has ensure that it has a priviledged status, it attempts a delete.
XML-RPC 1.1.0 fails with fault code 4: Invalid User and does not delete the image, XML-RPC 1.1.1 succeeds.
Sample code to reproduce (C#, SmugTools pre-Alpha library)
[php]
public static void Test_DeleteImage()
{
int imageID = 35891634; //35655858
SmugmugApi api = new SmugmugApi(emailAddress, password, transferLogFile, detailedLogFile);
ImageInfo info = api.GetImageInfo(imageID);
Debug.Assert(info.Watermark != null); //Assert I have permission to manipulate this image
api.DeleteImage(imageID);
//Negative test - Foreign image
bool exceptionCaught = false;
try
{
api.DeleteImage(5739903);
}
catch (SmugmugAccessException)
{
exceptionCaught = true;
}
Debug.Assert(exceptionCaught);
[/php]
XML from XML-RPC 1.1.0:
[php]
<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.images.getInfo</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<i4>35891634</i4>
</value>
</param>
</params>
</methodCall>
Header
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>AlbumID</name>
<value>
<int>804780</int>
</value>
</member>
<member>
<name>FileName</name>
<value>
<string>DSC06694.JPG</string>
</value>
</member>
<member>
<name>Caption</name>
<value>
<string/>
</value>
</member>
<member>
<name>Keywords</name>
<value>
<string/>
</value>
</member>
<member>
<name>Position</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>Date</name>
<value>
<string>2005-09-13 05:24:00</string>
</value>
</member>
<member>
<name>Format</name>
<value>
<string>JPG</string>
</value>
</member>
<member>
<name>Serial</name>
<value>
<int>0</int>
</value>
</member>
<member>
<name>Watermark</name>
<value>
<string>0</string>
</value>
</member>
<member>
<name>Size</name>
<value>
<int>2635816</int>
</value>
</member>
<member>
<name>Width</name>
<value>
<int>3264</int>
</value>
</member>
<member>
<name>Height</name>
<value>
<int>2448</int>
</value>
</member>
<member>
<name>MD5Sum</name>
<value>
<string>sm-2ee7298c1eb886b99fd4c5b00f2d4829-sm</string>
</value>
</member>
<member>
<name>LastUpdated</name>
<value>
<string>20050913052406</string>
</value>
</member>
<member>
<name>OriginalURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-O.jpg</string>
</value>
</member>
<member>
<name>LargeURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-L.jpg</string>
</value>
</member>
<member>
<name>MediumURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-M.jpg</string>
</value>
</member>
<member>
<name>SmallURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-S.jpg</string>
</value>
</member>
<member>
<name>TinyURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-Ti.jpg</string>
</value>
</member>
<member>
<name>ThumbURL</name>
<value>
<string>http://SmugTools.smugmug.com/photos/35891634-Th.jpg</string>
</value>
</member>
<member>
<name>AlbumURL</name>
<value>
<string>http://SmugTools.smugmug.com/gallery/804780/1/35891634</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
Header
<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.images.delete</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<i4>35891634</i4>
</value>
</param>
</params>
</methodCall>
Header
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>4</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string>invalid user</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
[/php]
Whereas the response to the delete request against XML-RPC 1.1.1 BETA
[php]
<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.images.delete</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<i4>35891634</i4>
</value>
</param>
</params>
</methodCall>
Header
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<string>SUCCESS</string>
</value>
</param>
</params>
</methodResponse>
[/php]
Cheers,
Luke
0