Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

fix: don't call a file or host named with TLS or SSL a certificate problem (#182)

Rudy Mizrahi Celekli6c7233427e04
diff --git a/e2e/format.spec.ts b/e2e/format.spec.ts
index f2e5280..54605d2 100644
--- a/e2e/format.spec.ts
+++ b/e2e/format.spec.ts
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test'
import {
+ describeError,
formatBytes,
formatEta,
formatPercent,
@@ -41,4 +42,21 @@ test.describe('formatting @smoke', () => {
expect(formatEta(59.5)).toBe('1m 0s')
expect(formatEta(61)).toBe('1m 1s')
})
+
+ test('a name with TLS or SSL in it isn’t read as a certificate problem', () => {
+ const certificate = /security certificate/
+ expect(describeError(new Error('unable to verify the first certificate'))).toMatch(certificate)
+ expect(describeError(new Error('certificate has expired'))).toMatch(certificate)
+ expect(
+ describeError(
+ new Error('Client network socket disconnected before secure TLS connection was established')
+ )
+ ).toMatch(certificate)
+ expect(describeError(new Error('Windows can’t save a file named Thesis: TLS 1.3.pdf'))).toBe(
+ 'Windows can’t save a file named Thesis: TLS 1.3.pdf'
+ )
+ expect(
+ describeError(new Error('No selected network has an address compatible with ssl.example.com'))
+ ).toBe('No selected network has an address compatible with ssl.example.com')
+ })
})
diff --git a/src/shared/errors.ts b/src/shared/errors.ts
index 342aa7d..6705a73 100644
--- a/src/shared/errors.ts
+++ b/src/shared/errors.ts
@@ -79,7 +79,8 @@ const ERROR_HINTS: Array<{ pattern: RegExp; message: string }> = [
message: 'The connection timed out. Check your network and try again.'
},
{
- pattern: /CERT|SSL|TLS/i,
+ // What Node and OpenSSL say, not any message that names a file or host with TLS or SSL in it.
+ pattern: /certificate|SSL routines|secure TLS connection/,
message:
'The server’s security certificate couldn’t be verified. Check the link or try again later.'
},