Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3520123
D8364.id28235.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D8364.id28235.diff
View Options
diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js
--- a/web/input/input-state-container.react.js
+++ b/web/input/input-state-container.react.js
@@ -1,6 +1,5 @@
// @flow
-import { detect as detectBrowser } from 'detect-browser';
import invariant from 'invariant';
import _groupBy from 'lodash/fp/groupBy.js';
import _keyBy from 'lodash/fp/keyBy.js';
@@ -115,10 +114,6 @@
import { useSelector } from '../redux/redux-utils.js';
import { nonThreadCalendarQuery } from '../selectors/nav-selectors.js';
-const browser = detectBrowser();
-const exifRotate =
- !browser || (browser.name !== 'safari' && browser.name !== 'chrome');
-
type BaseProps = {
+children: React.Node,
};
@@ -746,7 +741,7 @@
let response;
const validationStart = Date.now();
try {
- response = await validateFile(file, exifRotate);
+ response = await validateFile(file);
} catch (e) {
return {
steps,
diff --git a/web/media/media-utils.js b/web/media/media-utils.js
--- a/web/media/media-utils.js
+++ b/web/media/media-utils.js
@@ -1,5 +1,6 @@
// @flow
+import { detect as detectBrowser } from 'detect-browser';
import * as React from 'react';
import { thumbHashToDataURL } from 'thumbhash';
@@ -96,10 +97,12 @@
uri: string,
dimensions: ?Dimensions,
};
-async function processFile(
- file: File,
- exifRotate: boolean,
-): Promise<{
+
+const browser = detectBrowser();
+const exifRotate =
+ !browser || (browser.name !== 'safari' && browser.name !== 'chrome');
+
+async function processFile(file: File): Promise<{
steps: $ReadOnlyArray<MediaMissionStep>,
result: MediaMissionFailure | ProcessFileSuccess,
}> {
@@ -194,23 +197,20 @@
return { steps, result: { success: true, uri, dimensions } };
}
-type FileValidationSuccess = {
+export type FileValidationSuccess = {
success: true,
file: File,
mediaType: MediaType,
uri: string,
dimensions: ?Dimensions,
};
-async function validateFile(
- file: File,
- exifRotate: boolean,
-): Promise<{
+async function validateFile(file: File): Promise<{
steps: $ReadOnlyArray<MediaMissionStep>,
result: MediaMissionFailure | FileValidationSuccess,
}> {
const [probeResponse, processResponse] = await Promise.all([
probeFile(file),
- processFile(file, exifRotate),
+ processFile(file),
]);
const { steps: probeSteps, result: probeResult } = probeResponse;
const { steps: processSteps, result: processResult } = processResponse;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 11:26 PM (19 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2697311
Default Alt Text
D8364.id28235.diff (2 KB)
Attached To
Mode
D8364: [web] Move `exifRotate` from `input-state-container` to `media-utils`
Attached
Detach File
Event Timeline
Log In to Comment