-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-description
- Loading branch information
Showing
13 changed files
with
140 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3.4" | ||
|
||
services: | ||
stac-browser: | ||
image: ghcr.io/geowerkstatt/stac-browser:latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# This script gets all changelog entries from CHANGELOG.md since last release. | ||
|
||
set -e | ||
|
||
tempDir="$(mktemp -d)" | ||
tempFile=$tempDir/gh_release_notes.md | ||
|
||
# Get changelog entries since last release | ||
cat CHANGELOG.md | \ | ||
grep -Pazo '(?s)(?<=\#{2} \[Unreleased\]\n{2}).*?(?=\n\#{2} v|$)' \ | ||
> $tempFile | ||
|
||
# Improve readability and add some icons | ||
sed -i -E 's/(###) (Added)/\1 🚀 \2/' $tempFile | ||
sed -i -E 's/(###) (Changed)/\1 🔨 \2/' $tempFile | ||
sed -i -E 's/(###) (Fixed)/\1 🐛 \2/' $tempFile | ||
sed -i 's/\x0//g' $tempFile | ||
|
||
cat $tempFile | ||
|
||
# Cleanup temporary files | ||
trap 'rm -rf -- "$tempDir"' EXIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace Geopilot.Api; | ||
|
||
/// <summary> | ||
/// GeoPilot API string extensions. | ||
/// </summary> | ||
public static class StringExtensions | ||
{ | ||
/// <summary> | ||
/// Sanitizes a file name by removing invalid characters. | ||
/// </summary> | ||
/// <param name="fileName">The file name to sanitize.</param> | ||
/// <returns>The sanitized file name.</returns> | ||
/// <exception cref="ArgumentNullException">If <paramref name="fileName"/> is <c>null</c>, | ||
/// empty or white space.</exception>" | ||
public static string SanitizeFileName(this string fileName) | ||
{ | ||
if (string.IsNullOrWhiteSpace(fileName)) throw new ArgumentNullException(nameof(fileName)); | ||
|
||
// Get invalid characters for file names and add some platform-specific ones. | ||
var invalidFileNameChars = Path.GetInvalidFileNameChars() | ||
.Concat(new[] { '?', '$', '*', '|', '<', '>', '"', ':', '\\' }).ToArray(); | ||
|
||
return Path.GetFileName(new string(fileName | ||
.Trim() | ||
.ReplaceLineEndings(string.Empty) | ||
.Replace("..", string.Empty) | ||
.Replace("./", string.Empty) | ||
.Where(x => !invalidFileNameChars.Contains(x)).ToArray())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace Geopilot.Api.Controllers; | ||
|
||
[TestClass] | ||
public class StringExtensions | ||
{ | ||
[TestMethod] | ||
[DataRow("SQUIRRELGENESIS", "SQUIRRELGENESIS")] | ||
[DataRow("JUNIORARK.xyz", "JUNIORARK.xyz")] | ||
[DataRow("PEEVEDBEAM-ANT.MESS.abc", "PEEVEDBEAM-ANT.MESS.abc")] | ||
[DataRow("WEIRD WATER.example", "WEIRD WATER.example")] | ||
[DataRow("AUTOFIRE123.doc", "AUTOFIRE123.doc")] | ||
[DataRow("SUNNY(1).doc", "SUNNY(1).doc")] | ||
[DataRow("ODD_MONKEY.doc", "ODD_MONKEY.doc")] | ||
[DataRow("SILLY,MONKEY.docx", "SILLY,MONKEY.docx")] | ||
[DataRow("CamelCase.bat", "CamelCase.bat")] | ||
[DataRow("SLICKER-CHIPMUNK.bat", "SLICKER-CHIPMUNK.bat")] | ||
public void SanitizeFileNameForValidFileNames(string expected, string fileName) | ||
=> Assert.AreEqual(expected, fileName.SanitizeFileName()); | ||
|
||
[TestMethod] | ||
[DataRow("CHIPMUNKWALK", " CHIPMUNKWALK ")] | ||
[DataRow("SLEEPYBOUNCE", "SLEEPYBOUNCE\n")] | ||
[DataRow("PLOWARK", "PLOWARK\r")] | ||
[DataRow("JUNIORGLEE", "JUNIORGLEE\t")] | ||
[DataRow("SILLYWATER", "SILLYWATER\r\n")] | ||
[DataRow("LATENTROUTE34", "LATENTROUTE?34")] | ||
[DataRow("TRAWLSOUFFLE", "/TRAWLSOUFFLE*")] | ||
[DataRow("VIOLENTIRON", "><VIOLENTIRON\"|")] | ||
[DataRow("YELLOWBAGEL", "YELLOWBAGEL://")] | ||
[DataRow("ZANYWATER", "ZANYWATER$")] | ||
[DataRow("SLICKERCANDID", "..\\SLICKERCANDID")] | ||
[DataRow("DIREFOOT", "./DIREFOOT:")] | ||
[DataRow("FIREFOOT", ".../...//FIREFOOT\\")] | ||
public void SanitizeFileNameForInvalidFileNames(string expected, string fileName) | ||
=> Assert.AreEqual(expected, fileName.SanitizeFileName()); | ||
|
||
[TestMethod] | ||
public void SanitizeFileNameForInvalid() | ||
{ | ||
Assert.ThrowsException<ArgumentNullException>(() => string.Empty.SanitizeFileName()); | ||
Assert.ThrowsException<ArgumentNullException>(() => " ".SanitizeFileName()); | ||
Assert.ThrowsException<ArgumentNullException>(() => (null as string).SanitizeFileName()); | ||
} | ||
} |