Fossil SCM
Added missing checks for negative result value from symbolic_name_to_rid() (indicating an ambiguous name).
Commit
d8c21f2f09089fc31c883557510ae807b0571a3061eb53da8b5dbbf1b18030ae
Parent
bd81a5f60129963…
1 file changed
+7
-1
+7
-1
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -1103,10 +1103,14 @@ | ||
| 1103 | 1103 | *vid = symbolic_name_to_rid(zRev, "ci"); |
| 1104 | 1104 | if(0==*vid){ |
| 1105 | 1105 | fileedit_ajax_error(404,"Cannot resolve name as a checkin: %s", |
| 1106 | 1106 | zRev); |
| 1107 | 1107 | return 0; |
| 1108 | + }else if(*vid<0){ | |
| 1109 | + fileedit_ajax_error(400,"Checkin name is ambiguous: %s", | |
| 1110 | + zRev); | |
| 1111 | + return 0; | |
| 1108 | 1112 | } |
| 1109 | 1113 | zFileUuid = fileedit_file_uuid(zFilename, *vid, 0); |
| 1110 | 1114 | if(zFileUuid==0){ |
| 1111 | 1115 | fileedit_ajax_error(404,"Checkin does not contain file."); |
| 1112 | 1116 | return 0; |
| @@ -1119,11 +1123,10 @@ | ||
| 1119 | 1123 | }else{ |
| 1120 | 1124 | fossil_free(zCi); |
| 1121 | 1125 | } |
| 1122 | 1126 | return 1; |
| 1123 | 1127 | } |
| 1124 | - | |
| 1125 | 1128 | |
| 1126 | 1129 | /* |
| 1127 | 1130 | ** WEBPAGE: fileedit_content |
| 1128 | 1131 | ** |
| 1129 | 1132 | ** Query parameters: |
| @@ -1293,10 +1296,13 @@ | ||
| 1293 | 1296 | } |
| 1294 | 1297 | vid = symbolic_name_to_rid(zFlag, "ci"); |
| 1295 | 1298 | if(0==vid){ |
| 1296 | 1299 | rc = 404; |
| 1297 | 1300 | fail((pErr,"Could not resolve checkin version.")); |
| 1301 | + }else if(vid<0){ | |
| 1302 | + rc = 400; | |
| 1303 | + fail((pErr,"Checkin name is ambiguous.")); | |
| 1298 | 1304 | } |
| 1299 | 1305 | p->zParentUuid = rid_to_uuid(vid)/*fully expand it*/; |
| 1300 | 1306 | |
| 1301 | 1307 | zFileUuid = fileedit_file_uuid(p->zFilename, vid, &p->filePerm); |
| 1302 | 1308 | if(!zFileUuid){ |
| 1303 | 1309 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1103,10 +1103,14 @@ | |
| 1103 | *vid = symbolic_name_to_rid(zRev, "ci"); |
| 1104 | if(0==*vid){ |
| 1105 | fileedit_ajax_error(404,"Cannot resolve name as a checkin: %s", |
| 1106 | zRev); |
| 1107 | return 0; |
| 1108 | } |
| 1109 | zFileUuid = fileedit_file_uuid(zFilename, *vid, 0); |
| 1110 | if(zFileUuid==0){ |
| 1111 | fileedit_ajax_error(404,"Checkin does not contain file."); |
| 1112 | return 0; |
| @@ -1119,11 +1123,10 @@ | |
| 1119 | }else{ |
| 1120 | fossil_free(zCi); |
| 1121 | } |
| 1122 | return 1; |
| 1123 | } |
| 1124 | |
| 1125 | |
| 1126 | /* |
| 1127 | ** WEBPAGE: fileedit_content |
| 1128 | ** |
| 1129 | ** Query parameters: |
| @@ -1293,10 +1296,13 @@ | |
| 1293 | } |
| 1294 | vid = symbolic_name_to_rid(zFlag, "ci"); |
| 1295 | if(0==vid){ |
| 1296 | rc = 404; |
| 1297 | fail((pErr,"Could not resolve checkin version.")); |
| 1298 | } |
| 1299 | p->zParentUuid = rid_to_uuid(vid)/*fully expand it*/; |
| 1300 | |
| 1301 | zFileUuid = fileedit_file_uuid(p->zFilename, vid, &p->filePerm); |
| 1302 | if(!zFileUuid){ |
| 1303 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1103,10 +1103,14 @@ | |
| 1103 | *vid = symbolic_name_to_rid(zRev, "ci"); |
| 1104 | if(0==*vid){ |
| 1105 | fileedit_ajax_error(404,"Cannot resolve name as a checkin: %s", |
| 1106 | zRev); |
| 1107 | return 0; |
| 1108 | }else if(*vid<0){ |
| 1109 | fileedit_ajax_error(400,"Checkin name is ambiguous: %s", |
| 1110 | zRev); |
| 1111 | return 0; |
| 1112 | } |
| 1113 | zFileUuid = fileedit_file_uuid(zFilename, *vid, 0); |
| 1114 | if(zFileUuid==0){ |
| 1115 | fileedit_ajax_error(404,"Checkin does not contain file."); |
| 1116 | return 0; |
| @@ -1119,11 +1123,10 @@ | |
| 1123 | }else{ |
| 1124 | fossil_free(zCi); |
| 1125 | } |
| 1126 | return 1; |
| 1127 | } |
| 1128 | |
| 1129 | /* |
| 1130 | ** WEBPAGE: fileedit_content |
| 1131 | ** |
| 1132 | ** Query parameters: |
| @@ -1293,10 +1296,13 @@ | |
| 1296 | } |
| 1297 | vid = symbolic_name_to_rid(zFlag, "ci"); |
| 1298 | if(0==vid){ |
| 1299 | rc = 404; |
| 1300 | fail((pErr,"Could not resolve checkin version.")); |
| 1301 | }else if(vid<0){ |
| 1302 | rc = 400; |
| 1303 | fail((pErr,"Checkin name is ambiguous.")); |
| 1304 | } |
| 1305 | p->zParentUuid = rid_to_uuid(vid)/*fully expand it*/; |
| 1306 | |
| 1307 | zFileUuid = fileedit_file_uuid(p->zFilename, vid, &p->filePerm); |
| 1308 | if(!zFileUuid){ |
| 1309 |