-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: apply correct mimeType in iOS #1023
Conversation
}, | ||
status: OsReceiveFileStatus.toUpload, | ||
type: file.mimeType | ||
type: 'application/pdf' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about jpg/mov or else? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch wasn't supposed to be there at all. I guess the unit test failed at detecting it, I'm going to update it too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we check the iOS code to see why we can't rely on the mimeType? It sounds weird 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well in iOS the mimetype is just ".pdf" for pdf for instance. The stack does not recognize it and the file has no icon. (not really breaking in itself). On Android the mimeType has the expected web format
}, | ||
status: OsReceiveFileStatus.toUpload, | ||
type: file.mimeType | ||
type: 'application/pdf' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'application/pdf' here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot to remove it when I switched from the mac to the PC 🤦
@@ -12,6 +13,8 @@ import { | |||
ReceivedFile, | |||
OS_RECEIVE_PROTOCOL_NAME | |||
} from '/app/domain/osReceive/models/ReceivedFile' | |||
import { Media } from '/app/domain/backup/models' | |||
import { getMimeType } from '/app/domain/backup/services/getMedias' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to write it down because I did not think about it before, but we should move getMimeType from backup service to upload service one day.
d942558
to
456c9b4
Compare
Directly in file creation so no need to update it later. Also ensure file name and file path are decoded URI to avoid encoded spaces (%20) or other encoded characters by the import lib
456c9b4
to
9f6c286
Compare
Name was an UUID for images & videos, now using real name Also removing file:// prefix in filepaths as it made RNFS unable to retrieve the file, and silently creating empty files
7c122d4
to
54328e9
Compare
Still keeping our app as safeguard precaution for now. If the mimetype is correct it adds no overhead since it will pass it through
.containerURL(forSecurityApplicationGroupIdentifier: "group.\(this.hostAppBundleIdentifier)")! | ||
.appendingPathComponent("\(newName).\(fileExtension)") | ||
.containerURL(forSecurityApplicationGroupIdentifier: "group.\(this.hostAppBundleIdentifier)")! | ||
.appendingPathComponent(originalFileName) // Use the original file name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is incorrect, fixing it (fixed)
|
||
const createOsReceiveFile = (file: ReceivedFile): OsReceiveFile => { | ||
const decodedFileName = decodeFileName(file.fileName) | ||
const mimeType = determineMimeType(file.fileName, file.mimeType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember there was a diff on checking mimeType for Android received files and for iOS received files, did you check that on both platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember there was a diff on checking mimeType for Android received files and for iOS received files, did you check that on both platform?
yes, on Android I just use mimeType
directly since it's correct. Only on iOS I try to guess it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok and so there is no diff on the name part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only on iOS I try to guess it
Don't you fixed that here? https://github.com/cozy/cozy-flagship-app/pull/1023/files#diff-e5fbd9f4b85d62986896fb1d8408ad2d8d5a0f2267b5e0b22a9caef7c97255bb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only on iOS I try to guess it
Don't you fixed that here? https://github.com/cozy/cozy-flagship-app/pull/1023/files#diff-e5fbd9f4b85d62986896fb1d8408ad2d8d5a0f2267b5e0b22a9caef7c97255bb
that's true, the Platform checking is then redundant
--exclude build
abb6232
to
5d2c98f
Compare
Will use mimeType for both ios and android since the share lib is patched Still include failsafe
5d2c98f
to
7a4133b
Compare
This patch wasn't needed. It competes with the other patch we implemented in clearReceivedFiles We have to let it be so the event handlers respond correctly to file sharing
This PR will fix: