Title: [218987] trunk/Websites/perf.webkit.org
Revision
218987
Author
[email protected]
Date
2017-06-29 21:43:00 -0700 (Thu, 29 Jun 2017)

Log Message

UploadedFile should include the file extension in its url
https://bugs.webkit.org/show_bug.cgi?id=174009

Reviewed by Chris Dumez.

Some command line tools such as darwinup use the file extension to determine the file type.
Include the file extension in the URL of an uploaded file to make it work with these tools.

* public/include/uploaded-file-helpers.php:
(format_uploaded_file): Include the file extension.
* public/v3/models/uploaded-file.js:
(UploadedFile):
(UploadedFile.prototype.url): Return the URL with hthe file extension specified. /api/uploaded-file
already supports having the file extension specified.
* server-tests/tools-sync-buildbot-integration-tests.js: Updated test cases.
* unit-tests/buildbot-syncer-tests.js: Ditto.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (218986 => 218987)


--- trunk/Websites/perf.webkit.org/ChangeLog	2017-06-30 03:43:25 UTC (rev 218986)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2017-06-30 04:43:00 UTC (rev 218987)
@@ -1,3 +1,22 @@
+2017-06-29  Ryosuke Niwa  <[email protected]>
+
+        UploadedFile should include the file extension in its url
+        https://bugs.webkit.org/show_bug.cgi?id=174009
+
+        Reviewed by Chris Dumez.
+
+        Some command line tools such as darwinup use the file extension to determine the file type.
+        Include the file extension in the URL of an uploaded file to make it work with these tools.
+
+        * public/include/uploaded-file-helpers.php:
+        (format_uploaded_file): Include the file extension.
+        * public/v3/models/uploaded-file.js:
+        (UploadedFile):
+        (UploadedFile.prototype.url): Return the URL with hthe file extension specified. /api/uploaded-file
+        already supports having the file extension specified.
+        * server-tests/tools-sync-buildbot-integration-tests.js: Updated test cases.
+        * unit-tests/buildbot-syncer-tests.js: Ditto.
+
 2017-05-31  Ryosuke Niwa  <[email protected]>
 
         Don't shouldn't create a request to build a patch if there is no patch to build

Modified: trunk/Websites/perf.webkit.org/public/include/uploaded-file-helpers.php (218986 => 218987)


--- trunk/Websites/perf.webkit.org/public/include/uploaded-file-helpers.php	2017-06-30 03:43:25 UTC (rev 218986)
+++ trunk/Websites/perf.webkit.org/public/include/uploaded-file-helpers.php	2017-06-30 04:43:00 UTC (rev 218987)
@@ -10,6 +10,7 @@
         'createdAt' => Database::to_js_time($file_row['file_created_at']),
         'mime' => $file_row['file_mime'],
         'filename' => $file_row['file_filename'],
+        'extension' => $file_row['file_extension'],
         'author' => $file_row['file_author'],
         'sha256' => $file_row['file_sha256']);
 }

Modified: trunk/Websites/perf.webkit.org/public/v3/models/uploaded-file.js (218986 => 218987)


--- trunk/Websites/perf.webkit.org/public/v3/models/uploaded-file.js	2017-06-30 03:43:25 UTC (rev 218986)
+++ trunk/Websites/perf.webkit.org/public/v3/models/uploaded-file.js	2017-06-30 04:43:00 UTC (rev 218987)
@@ -7,6 +7,7 @@
         this._createdAt = new Date(object.createdAt);
         this._deletedAt = object.deletedAt ? new Date(object.deletedAt) : null;
         this._filename = object.filename;
+        this._extension = object.extension;
         this._author = object.author;
         this._size = object.size;
         this._sha256 = object.sha256;
@@ -19,7 +20,7 @@
     author() { return this._author; }
     size() { return this._size; }
     label() { return this.filename(); }
-    url() { return RemoteAPI.url(`/api/uploaded-file/${this.id()}`); }
+    url() { return RemoteAPI.url(`/api/uploaded-file/${this.id()}${this._extension}`); }
 
     static uploadFile(file, uploadProgressCallback = null)
     {

Modified: trunk/Websites/perf.webkit.org/server-tests/tools-sync-buildbot-integration-tests.js (218986 => 218987)


--- trunk/Websites/perf.webkit.org/server-tests/tools-sync-buildbot-integration-tests.js	2017-06-30 03:43:25 UTC (rev 218986)
+++ trunk/Websites/perf.webkit.org/server-tests/tools-sync-buildbot-integration-tests.js	2017-06-30 04:43:00 UTC (rev 218987)
@@ -173,7 +173,7 @@
         }).then(() => {
             assert.equal(requests.length, 7);
             assertAndResolveRequest(requests[6], 'POST', '/builders/some%20builder/force', 'OK');
-            assert.deepEqual(requests[6].data, {'wk': '191622', 'wk-patch': RemoteAPI.url('/api/uploaded-file/1'),
+            assert.deepEqual(requests[6].data, {'wk': '191622', 'wk-patch': RemoteAPI.url('/api/uploaded-file/1.dat'),
                 'build-request-id': '1', 'forcescheduler': 'force-ab-builds'});
             return MockRemoteAPI.waitForRequest();
         }).then(() => {

Modified: trunk/Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js (218986 => 218987)


--- trunk/Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js	2017-06-30 03:43:25 UTC (rev 218986)
+++ trunk/Websites/perf.webkit.org/unit-tests/buildbot-syncer-tests.js	2017-06-30 04:43:00 UTC (rev 218987)
@@ -229,10 +229,10 @@
     const shared111237 = CommitLog.ensureSingleton('111237', {'id': '111237', 'time': 1456931874000, 'repository': MockModels.sharedRepository, 'revision': '80229'});
     const ios13A452 = CommitLog.ensureSingleton('88930', {'id': '88930', 'time': 0, 'repository': MockModels.ios, 'revision': '13A452'});
 
-    const patch = new UploadedFile(453, {'createdAt': new Date('2017-05-01T19:16:53Z'), 'filename': 'patch.dat', 'author': 'some user',
+    const patch = new UploadedFile(453, {'createdAt': new Date('2017-05-01T19:16:53Z'), 'filename': 'patch.dat', 'extension': '.dat', 'author': 'some user',
         size: 534637, sha256: '169463c8125e07c577110fe144ecd63942eb9472d438fc0014f474245e5df8a1'});
 
-    const root = new UploadedFile(456, {'createdAt': new Date('2017-05-01T21:03:27Z'), 'filename': 'root.dat', 'author': 'some user',
+    const root = new UploadedFile(456, {'createdAt': new Date('2017-05-01T21:03:27Z'), 'filename': 'root.dat', 'extension': '.dat', 'author': 'some user',
         size: 16452234, sha256: '03eed7a8494ab8794c44b7d4308e55448fc56f4d6c175809ba968f78f656d58d'});
 
     const commitSet = CommitSet.ensureSingleton('53246456', {customRoots: [root], revisionItems: [{commit: webkit197463, patch}, {commit: shared111237}, {commit: ios13A452}]});
@@ -975,7 +975,7 @@
             const request = createSampleBuildRequestWithPatch(MockModels.iphone, null, -1);
             const properties = syncers[2]._propertiesForBuildRequest(request, [request]);
             assert.equal(properties['webkit'], '197463');
-            assert.equal(properties['webkit-patch'], 'http://build.webkit.org/api/uploaded-file/453');
+            assert.equal(properties['webkit-patch'], 'http://build.webkit.org/api/uploaded-file/453.dat');
         });
 
         it('should resolve "ifBuilt"', () => {
@@ -996,16 +996,16 @@
             const requestToBuild = createSampleBuildRequestWithPatch(MockModels.iphone, null, -1);
             const requestToTest = createSampleBuildRequestWithPatch(MockModels.iphone, MockModels.speedometer, 0);
             const otherRequestToTest = createSampleBuildRequest(MockModels.iphone, MockModels.speedometer);
-    
+
             let properties = syncers[0]._propertiesForBuildRequest(requestToTest, [requestToTest]);
             assert.equal(properties['webkit'], '197463');
-            assert.equal(properties['roots'], '[{"url":"http://build.webkit.org/api/uploaded-file/456"}]');
+            assert.equal(properties['roots'], '[{"url":"http://build.webkit.org/api/uploaded-file/456.dat"}]');
             assert.equal(properties['test-custom-build'], undefined);
             assert.equal(properties['has-built-patch'], undefined);
 
             properties = syncers[0]._propertiesForBuildRequest(requestToTest, [requestToBuild, requestToTest]);
             assert.equal(properties['webkit'], '197463');
-            assert.equal(properties['roots'], '[{"url":"http://build.webkit.org/api/uploaded-file/456"}]');
+            assert.equal(properties['roots'], '[{"url":"http://build.webkit.org/api/uploaded-file/456.dat"}]');
             assert.equal(properties['test-custom-build'], '');
             assert.equal(properties['has-built-patch'], 'true');
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to