n8n-nodes-github-copilot 3.2.4 → 3.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,7 +82,7 @@ exports.nodeProperties = [
82
82
  name: 'includeMedia',
83
83
  type: 'boolean',
84
84
  default: false,
85
- description: 'Whether to include a media file (image or audio) in the message. Type is auto-detected.',
85
+ description: 'Whether to include a media file in the message. Supported: Images (PNG, JPEG, GIF, WebP) and Audio files. Type is auto-detected.',
86
86
  },
87
87
  {
88
88
  displayName: 'Media Source',
@@ -125,7 +125,7 @@ exports.nodeProperties = [
125
125
  },
126
126
  default: '',
127
127
  placeholder: 'Paste base64 string or file path',
128
- description: 'Media file as base64 string or file path (auto-detects image/audio)',
128
+ description: 'Media file as base64 string or file path (Images: PNG/JPEG/GIF/WebP, Audio: MP3/WAV/M4A)',
129
129
  },
130
130
  {
131
131
  displayName: 'Media URL',
@@ -139,7 +139,7 @@ exports.nodeProperties = [
139
139
  },
140
140
  default: '',
141
141
  placeholder: 'https://example.com/file.jpg',
142
- description: 'URL of the media file to download and include',
142
+ description: 'URL of the media file to download and include (Images: PNG/JPEG/GIF/WebP, Audio: MP3/WAV/M4A)',
143
143
  },
144
144
  {
145
145
  displayName: 'Media Binary Property',
@@ -7,3 +7,9 @@ export declare function processMediaFile(context: IExecuteFunctions, itemIndex:
7
7
  }>;
8
8
  export declare function isImageMimeType(mimeType: string): boolean;
9
9
  export declare function isAudioMimeType(mimeType: string): boolean;
10
+ export declare function validateImageFormat(mimeType: string): {
11
+ isValid: boolean;
12
+ error?: string;
13
+ };
14
+ export declare function getFileExtensionFromMimeType(mimeType: string): string;
15
+ export declare function suggestImageConversion(mimeType: string): string;
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAudioMimeType = exports.isImageMimeType = exports.processMediaFile = void 0;
3
+ exports.suggestImageConversion = exports.getFileExtensionFromMimeType = exports.validateImageFormat = exports.isAudioMimeType = exports.isImageMimeType = exports.processMediaFile = void 0;
4
4
  const index_1 = require("./index");
5
5
  async function processMediaFile(context, itemIndex, source, mediaFile, mediaUrl, binaryProperty) {
6
6
  try {
7
7
  try {
8
8
  const imageResult = await (0, index_1.processImageFile)(context, itemIndex, source, mediaFile, mediaUrl, binaryProperty);
9
+ const formatValidation = validateImageFormat(imageResult.mimeType);
10
+ if (!formatValidation.isValid) {
11
+ throw new Error(suggestImageConversion(imageResult.mimeType));
12
+ }
9
13
  return {
10
14
  type: 'image',
11
15
  dataUrl: `data:${imageResult.mimeType};base64,${imageResult.data}`,
12
- description: `Image file: ${imageResult.filename} (${Math.round(imageResult.size / 1024)}KB)`,
16
+ description: `Image file: ${imageResult.filename} (${Math.round(imageResult.size / 1024)}KB, ${imageResult.mimeType})`,
13
17
  mimeType: imageResult.mimeType,
14
18
  };
15
19
  }
@@ -24,7 +28,13 @@ async function processMediaFile(context, itemIndex, source, mediaFile, mediaUrl,
24
28
  };
25
29
  }
26
30
  catch (audioError) {
27
- throw new Error(`File is neither a valid image nor audio file. Image error: ${imageError instanceof Error ? imageError.message : 'Unknown'}. Audio error: ${audioError instanceof Error ? audioError.message : 'Unknown'}`);
31
+ const supportedImageFormats = ['PNG', 'JPEG', 'GIF', 'WebP'];
32
+ const supportedAudioFormats = ['MP3', 'WAV', 'M4A', 'OGG'];
33
+ throw new Error(`File is neither a valid image nor audio file.\n` +
34
+ `Supported image formats: ${supportedImageFormats.join(', ')}\n` +
35
+ `Supported audio formats: ${supportedAudioFormats.join(', ')}\n` +
36
+ `Image error: ${imageError instanceof Error ? imageError.message : 'Unknown'}\n` +
37
+ `Audio error: ${audioError instanceof Error ? audioError.message : 'Unknown'}`);
28
38
  }
29
39
  }
30
40
  }
@@ -38,7 +48,14 @@ async function processMediaFile(context, itemIndex, source, mediaFile, mediaUrl,
38
48
  }
39
49
  exports.processMediaFile = processMediaFile;
40
50
  function isImageMimeType(mimeType) {
41
- return mimeType.startsWith('image/') && !mimeType.includes('svg');
51
+ const supportedFormats = [
52
+ 'image/png',
53
+ 'image/jpeg',
54
+ 'image/jpg',
55
+ 'image/gif',
56
+ 'image/webp'
57
+ ];
58
+ return supportedFormats.includes(mimeType.toLowerCase());
42
59
  }
43
60
  exports.isImageMimeType = isImageMimeType;
44
61
  function isAudioMimeType(mimeType) {
@@ -47,3 +64,36 @@ function isAudioMimeType(mimeType) {
47
64
  mimeType === 'video/mp4';
48
65
  }
49
66
  exports.isAudioMimeType = isAudioMimeType;
67
+ function validateImageFormat(mimeType) {
68
+ if (!isImageMimeType(mimeType)) {
69
+ const supportedFormats = ['PNG', 'JPEG', 'GIF', 'WebP'];
70
+ return {
71
+ isValid: false,
72
+ error: `Unsupported image format: ${mimeType}. GitHub Copilot API only supports: ${supportedFormats.join(', ')}`
73
+ };
74
+ }
75
+ return { isValid: true };
76
+ }
77
+ exports.validateImageFormat = validateImageFormat;
78
+ function getFileExtensionFromMimeType(mimeType) {
79
+ const mimeToExt = {
80
+ 'image/png': 'png',
81
+ 'image/jpeg': 'jpg',
82
+ 'image/jpg': 'jpg',
83
+ 'image/gif': 'gif',
84
+ 'image/webp': 'webp',
85
+ 'image/bmp': 'bmp',
86
+ 'image/tiff': 'tiff',
87
+ 'image/svg+xml': 'svg',
88
+ };
89
+ return mimeToExt[mimeType.toLowerCase()] || 'unknown';
90
+ }
91
+ exports.getFileExtensionFromMimeType = getFileExtensionFromMimeType;
92
+ function suggestImageConversion(mimeType) {
93
+ const ext = getFileExtensionFromMimeType(mimeType);
94
+ const supportedFormats = ['PNG', 'JPEG', 'GIF', 'WebP'];
95
+ return `Image format ${ext.toUpperCase()} is not supported by GitHub Copilot API. ` +
96
+ `Please convert your image to one of these formats: ${supportedFormats.join(', ')}. ` +
97
+ `Recommended: Convert to PNG or WebP for best compatibility.`;
98
+ }
99
+ exports.suggestImageConversion = suggestImageConversion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "description": "n8n community node for GitHub Copilot with CLI integration and official Chat API access to GPT-5, Claude, Gemini and more using your existing Copilot credits",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",