@capacitor/share - there is not possible to share vcard by gmail
Maintainers usually reply within 9 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- ios, typescript
- Domain
- mobile-dev
Research direction
Start by reproducing the issue with @capacitor/share on iOS using the provided vCard generation and file-sharing code, then inspect the plugin's iOS implementation for file attachment handling. Done means the generated .vcf can be shared successfully through Gmail and Slack, with regression coverage for this case if the plugin has relevant tests.
Written by the indexing model from the issue text.
Description
Bug Report
Plugin(s)
@capacitor/share - 8.0.0
Capacitor Version
Latest Dependencies:
@capacitor/cli: 8.0.0
@capacitor/core: 8.0.0
@capacitor/android: 8.0.0
@capacitor/ios: 8.0.0
Installed Dependencies:
@capacitor/cli: 8.0.0
@capacitor/core: 8.0.0
@capacitor/android: 8.0.0
@capacitor/ios: 8.0.0
Platform(s)
iOS
Current Behavior
I am creating vcard info for sharing. The code work well for most cases but when I want to share .vcf file by Gmail or Slack, it tells me "The files you are trying to attach are invalid."
Expected Behavior
Possible to share vcard file by Gmail and Slack
Code Reproduction
if (!text) return '';
return text
.replace(/\\/g, '\\\\')
.replace(/\n/g, '\\n')
.replace(/,/g, '\\,')
.replace(/;/g, '\\;');
}
toAsciiFileName(s: string) {
return (s || '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.replace(/[^a-zA-Z0-9_-]/g, '_');
}
generateVCard(contact: {
firstName: string;
lastName: string;
phone?: string;
email?: string;
organization?: string;
address?: string;
website?: string;
}): string {
const lines: string[] = [];
lines.push('BEGIN:VCARD');
lines.push('VERSION:3.0');
const lastName = this.escapeVCard(contact.lastName);
const firstName = this.escapeVCard(contact.firstName);
lines.push(`N:${lastName};${firstName};;;`);
lines.push(`FN:${firstName} ${lastName}`.trim());
if (contact.organization) {
lines.push(`ORG:${this.escapeVCard(contact.organization)}`);
}
if (contact.phone) {
lines.push(`TEL;TYPE=CELL:${this.escapeVCard(contact.phone)}`);
}
if (contact.email) {
lines.push(`EMAIL;TYPE=INTERNET:${this.escapeVCard(contact.email)}`);
}
if (contact.address) {
const addressParts = contact.address.split(';');
const escapedParts = addressParts.map(part => this.escapeVCard(part));
lines.push(`ADR;TYPE=HOME:;;${escapedParts.join(';')}`);
}
if (contact.website) {
lines.push(`URL:${this.escapeVCard(contact.website)}`);
}
lines.push('END:VCARD');
return lines.join('\r\n') + '\r\n';
}
async contactShare(): Promise<void> {
if (!this.vcardValue) return;
const safeFirst = this.toAsciiFileName(this.firstname);
const safeLast = this.toAsciiFileName(this.lastname);
const fileName = `${safeFirst || 'Contact'}_${safeLast || 'VCard'}.vcf`;
const dir = Directory.Documents;
await Filesystem.writeFile({path: fileName, data: this.vcardValue, directory: dir, encoding: Encoding.UTF8});
const {uri} = await Filesystem.getUri({directory: dir, path: fileName});
await Share.share({
title: `${this.firstname} ${this.lastname}`.trim(),
dialogTitle: 'Share contact',
files: [uri],
});
}
Other Technical Details
Additional Context
- Dominant language
- Java
- Stars
- 683
- Forks
- 692
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/capacitor-plugins
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguageOpentriage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ionic-team/capacitor-plugins#2604 ·
Maintainers usually reply within 9 days
-
platform: android
Difficulty 3/5 1-2 days Newbie friendliness 78/100
ionic-team/capacitor-plugins#2605 ·
Maintainers usually reply within 9 days
-
bug(camera): chooseFromGallery blocks the main thread on iOS while the photo grid opensPossibly taken @masimplo claimed this 17 days ago. Openplatform: ios
Difficulty 4/5 3-5 days Newbie friendliness 58/100
ionic-team/capacitor-plugins#2603 · 1 comment ·
Maintainers usually reply within 9 days
-
platform: android
Difficulty 3/5 1-2 days Newbie friendliness 76/100
ionic-team/capacitor-plugins#2599 ·
Maintainers usually reply within 9 days
-
platform: ios
Difficulty 3/5 1-2 days Newbie friendliness 68/100
ionic-team/capacitor-plugins#2595 · 2 reactions ·
Maintainers usually reply within 9 days
All issues in ionic-team/capacitor-plugins
Similar issues
-
[BUG] Re-subscribing the Mono returned by listTools/listResources/listResourceTemplates/listPrompts/listRoots duplicates the resultsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/java-sdk#1174 · 1 reaction ·
Maintainers usually reply within 2 days
-
module: core
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bigbluebutton/bigbluebutton#26028 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
MetricsHub/metricshub-community#1390 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/rocketmq-dashboard#6331 ·
Maintainers usually reply within 5 days
-
status: team-only type: dependency-upgrade
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
spring-projects/spring-boot#52143 · 1 comment ·
Maintainers usually reply within 1 day