aboutsummaryrefslogtreecommitdiffstats
path: root/modules/references
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-01-31 17:08:05 +0800
committerGitHub <noreply@github.com>2023-01-31 10:08:05 +0100
commit36dc11869d0401b796a7a3f74627fec842a4a89a (patch)
tree8e01a953049ee155eae96bff8c17533f8815e520 /modules/references
parentf47ea60c075ddc09d39bc7817efc7c4d870dcd19 (diff)
downloadgitea-36dc11869d0401b796a7a3f74627fec842a4a89a.tar.gz
gitea-36dc11869d0401b796a7a3f74627fec842a4a89a.zip
Use correct captured group range when parsing cross-reference (#22672)
Fixes #22666 (Replace #22668) Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'modules/references')
-rw-r--r--modules/references/references.go6
-rw-r--r--modules/references/references_test.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/references/references.go b/modules/references/references.go
index 1022e5af3d..68662425cc 100644
--- a/modules/references/references.go
+++ b/modules/references/references.go
@@ -35,12 +35,12 @@ var (
// issueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$))`)
// crossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository
- // e.g. gogits/gogs#12345
+ // e.g. org/repo#12345
crossReferenceIssueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+[#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
// crossReferenceCommitPattern matches a string that references a commit in a different repository
// e.g. go-gitea/gitea@d8a994ef, go-gitea/gitea@d8a994ef243349f321568f9e36d5c3f444b99cae (7-40 characters)
crossReferenceCommitPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([0-9a-zA-Z-_\.]+)/([0-9a-zA-Z-_\.]+)@([0-9a-f]{7,40})(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
- // spaceTrimmedPattern let's us find the trailing space
+ // spaceTrimmedPattern let's find the trailing space
spaceTrimmedPattern = regexp.MustCompile(`(?:.*[0-9a-zA-Z-_])\s`)
// timeLogPattern matches string for time tracking
timeLogPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@([0-9]+([\.,][0-9]+)?(w|d|m|h))+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
@@ -365,7 +365,7 @@ func FindRenderizableCommitCrossReference(content string) (bool, *RenderizableRe
Owner: content[m[2]:m[3]],
Name: content[m[4]:m[5]],
CommitSha: content[m[6]:m[7]],
- RefLocation: &RefSpan{Start: m[0], End: m[1]},
+ RefLocation: &RefSpan{Start: m[2], End: m[7]},
}
}
diff --git a/modules/references/references_test.go b/modules/references/references_test.go
index 1159e14b37..75e002c99a 100644
--- a/modules/references/references_test.go
+++ b/modules/references/references_test.go
@@ -352,7 +352,7 @@ func TestFindRenderizableCommitCrossReference(t *testing.T) {
Owner: "go-gitea",
Name: "gitea",
CommitSha: "abcd1234",
- RefLocation: &RefSpan{Start: 4, End: 29},
+ RefLocation: &RefSpan{Start: 5, End: 28},
},
},
}
6013/stable27'>backport/46013/stable27 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/tests/preseed-config.php
blob: 16aea87c8a7a26a68e729c4e857065c5c533b144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php

$CONFIG = [
	'appstoreenabled' => false,
	'apps_paths' => [
		[
			'path' => OC::$SERVERROOT . '/apps',
			'url' => '/apps',
			'writable' => true,
		],
	],
];

if (is_dir(OC::$SERVERROOT.'/apps2')) {
	$CONFIG['apps_paths'][] = [
		'path' => OC::$SERVERROOT . '/apps2',
		'url' => '/apps2',
		'writable' => false,
	];
}

if (getenv('OBJECT_STORE') === 's3') {
	$CONFIG['objectstore'] = [
		'class' => 'OC\\Files\\ObjectStore\\S3',
		'arguments' => [
			'bucket' => 'nextcloud',
			'autocreate' => true,
			'key' => 'nextcloud',
			'secret' => 'nextcloud',
			'hostname' => getenv('DRONE') === 'true' ? 'minio' : 'localhost',
			'port' => 9000,
			'use_ssl' => false,
			// required for some non amazon s3 implementations
			'use_path_style' => true
		]
	];
}
if (getenv('OBJECT_STORE') === 'swift') {
	$swiftHost = getenv('DRONE') === 'true' ? 'dockswift' : 'localhost';

	if (getenv('SWIFT-AUTH') === 'v2.0') {
		$CONFIG['objectstore'] = [
			'class' => 'OC\\Files\\ObjectStore\\Swift',
			'arguments' => [
				'autocreate' => true,
				'username' => 'swift',
				'tenantName' => 'service',
				'password' => 'swift',
				'serviceName' => 'swift',
				'region' => 'regionOne',
				'url' => "http://$swiftHost:5000/v2.0",
				'bucket' => 'nextcloud'
			]
		];
	} else {
		$CONFIG['objectstore'] = [
			'class' => 'OC\\Files\\ObjectStore\\Swift',
			'arguments' => [
				'autocreate' => true,
				'user' => [
					'name' => 'swift',
					'password' => 'swift',
					'domain' => [
						'name' => 'default',
					]
				],
				'scope' => [
					'project' => [
						'name' => 'service',
						'domain' => [
							'name' => 'default',
						],
					],
				],
				'tenantName' => 'service',
				'serviceName' => 'swift',
				'region' => 'regionOne',
				'url' => "http://$swiftHost:5000/v3",
				'bucket' => 'nextcloud'
			]
		];
	}
}
if (getenv('OBJECT_STORE') === 'azure') {
	$CONFIG['objectstore'] = [
		'class' => 'OC\\Files\\ObjectStore\\Azure',
		'arguments' => [
			'container' => 'test',
			'account_name' => 'devstoreaccount1',
			'account_key' => 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==',
			'endpoint' => 'http://' . (getenv('DRONE') === 'true' ? 'azurite' : 'localhost') . ':10000/devstoreaccount1',
			'autocreate' => true
		]
	];
}