diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 8fed74d7c..baef6b216 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1885,7 +1885,7 @@ A hash reference of optional parameters. head4 assetId -Limit the search to a specific assetId to see if that url exists for that asset. +Excludes an asset, by assetId, for the search for the existance of the url. =cut @@ -1897,7 +1897,7 @@ sub urlExists { my $limit = ""; my $placeholders = [ $url ]; if (exists $options->{assetId}) { - $limit = "and assetId=?"; + $limit = "and assetId<>?"; push @{ $placeholders }, $options->{assetId}; } my ($test) = $session->db->quickArray("select count(url) from assetData where url=? $limit", $placeholders); diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index aace68e80..499ae845f 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -109,6 +109,6 @@ my $importId = $importNode->getId; ok( WebGUI::Asset->urlExists($session, $importUrl), 'url for import node exists'); ok( !WebGUI::Asset->urlExists($session, '/foo/bar/baz'), 'made up url does not exist'); -ok( WebGUI::Asset->urlExists($session, $importUrl, {assetId => $importId}), 'url for import node exists at specific id'); +ok( !WebGUI::Asset->urlExists($session, $importUrl, {assetId => $importId}), 'url for import node only exists at specific id'); ok( !WebGUI::Asset->urlExists($session, '/foo/bar/baz', {assetId => $importId}), 'imaginary url does not exist at specific id'); -ok( !WebGUI::Asset->urlExists($session, $importUrl, {assetId => 'notAnWebGUIId'}), 'imaginary url does not exist at wrong id'); +ok( WebGUI::Asset->urlExists($session, $importUrl, {assetId => 'notAnWebGUIId'}), 'imaginary url does not exist at wrong id');