We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c34d666 commit 18a3b3fCopy full SHA for 18a3b3f
sdk/src/Core/Amazon.Util/AWSSDKUtils.cs
@@ -203,7 +203,15 @@ public static string GetExtension(string path)
203
return null;
204
205
#if NET8_0_OR_GREATER
206
+ // LastIndexOf and LastIndexOfAny is vectorized on .NET8+ and is
207
+ // signifigantly faster for cases where 'path' does not end with a short file
208
+ // extension, such as GUIDs
209
int extensionIndex = path.AsSpan().LastIndexOf('.');
210
+ if (extensionIndex == -1)
211
+ {
212
+ return string.Empty;
213
+ }
214
+
215
int directoryIndex = path.AsSpan().LastIndexOfAny('/', '\\', ':');
216
217
// extension separator is found and exists before path separator or path separator doesn't exist
0 commit comments