Skip to content

Commit fa01840

Browse files
Merge pull request #2533 from Accenture/copilot/fix-asset-folder-creation
fix: prevent folder creation skip when same path exists in another BU
2 parents 9cc40d9 + 168060b commit fa01840

8 files changed

Lines changed: 658 additions & 10 deletions

File tree

.husky/commit-msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ INPUT_FILE=$1
22
START_LINE=`head -n1 $INPUT_FILE`
33
PATTERN="^(#[[:digit:]]|Merge|Revert)"
44

5-
if ! [[ "$START_LINE" =~ $PATTERN ]] ; then
5+
if ! echo "$START_LINE" | grep -qE "$PATTERN" ; then
66
echo "Bad commit message, see example: \"#431 commit message\", you provided: \"$START_LINE\""
77
exit 1
88
fi

.husky/post-checkout

100644100755
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/sh
12
# ### git commit message template ###
23
git config commit.template .git/templatemessage
34
TICKETID=`git rev-parse --abbrev-ref HEAD | LC_ALL=en_US.utf8 grep -oP '^((feature|bug|bugfix|fix|hotfix|task|chore)\/)?\K\d{1,7}' || true`
@@ -11,24 +12,21 @@ echo "[POST-CHECKOUT] Setting template commit to '$TEMPLATE'"
1112
echo "$TEMPLATE" > ".git/templatemessage"
1213

1314

14-
if [[ $SKIP_HOOKS>0 ]]; then
15+
if [ "${SKIP_HOOKS:-0}" -gt 0 ] 2>/dev/null; then
1516
echo "[POST-CHECKOUT] skipping hooks ($SKIP_HOOKS)"
1617
exit 0
1718
fi
1819

1920
# ### run npm install ###
2021
echo "[POST-CHECKOUT] 📦 Checking for changes to dependencies"
21-
# define how to split strings into array elements
22-
IFS=$'\n'
2322
# $1 is the new HEAD pointer
2423
NEWHEAD=$1
2524
# $2 is the previous HEAD pointer
2625
OLDHEAD=$2
2726
# extract all paths to package-lock.json files
28-
PACKAGE_LOCK_REGEX="(^package-lock\.json)"
29-
PACKAGES=$(git diff --name-only $OLDHEAD $NEWHEAD | grep -E $PACKAGE_LOCK_REGEX || true)
27+
PACKAGES=$(git diff --name-only "$OLDHEAD" "$NEWHEAD" | grep -E "^package-lock\.json" || true)
3028

31-
if [[ ${PACKAGES[@]} ]]; then
29+
if [ -n "$PACKAGES" ]; then
3230
for package in $PACKAGES; do
3331
echo "📦 $package was changed."
3432
done

@types/lib/metadataTypes/Folder.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/metadataTypes/Folder.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,12 @@ class Folder extends MetadataType {
224224
let existingId;
225225
try {
226226
// perform a secondary check based on path
227-
227+
// do not allow mapping folders from other BUs to avoid
228+
// treating a same-path folder from another BU as already existing
228229
const cachedVersion = cache.getFolderByPath(
229-
deployableMetadata.Path
230+
deployableMetadata.Path,
231+
undefined,
232+
false
230233
);
231234
existingId = cachedVersion?.ID;
232235
if (
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
5+
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
6+
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
7+
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
8+
<soap:Header>
9+
<wsa:Action>CreateResponse</wsa:Action>
10+
<wsa:MessageID>urn:uuid:50c68314-30a5-45d4-93aa-6dd1191190e3</wsa:MessageID>
11+
<wsa:RelatesTo>urn:uuid:00b40ac8-d7e8-4e55-8b88-fcf3569684a9</wsa:RelatesTo>
12+
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
13+
<wsse:Security>
14+
<wsu:Timestamp wsu:Id="Timestamp-26435e8f-90d6-4552-aabb-d5eefa3a4bed">
15+
<wsu:Created>2024-08-08T09:56:20Z</wsu:Created>
16+
<wsu:Expires>2024-08-08T10:01:20Z</wsu:Expires>
17+
</wsu:Timestamp>
18+
</wsse:Security>
19+
</soap:Header>
20+
<soap:Body>
21+
<CreateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">
22+
<Results>
23+
<StatusCode>OK</StatusCode>
24+
<StatusMessage>Folder created successfully.</StatusMessage>
25+
<OrdinalID>0</OrdinalID>
26+
<NewID>88888</NewID>
27+
<NewObjectID>a890243b-a4e1-4010-85e4-db6d6ae84502</NewObjectID>
28+
</Results>
29+
<RequestID>6b408e0b-ecbe-4b8e-9019-6376f6eeb0e2</RequestID>
30+
<OverallStatus>OK</OverallStatus>
31+
</CreateResponse>
32+
</soap:Body>
33+
</soap:Envelope>

0 commit comments

Comments
 (0)