Use of pipe character in the filename pattern causes crash

Description

If you use a pipe character in the file name pattern the program crashes.

For example:
${YYYY}${MM}${DD} | ${hh}${mm}${ss}

Happens when save destination is set to Save Directly.

Software version: 1.2.4.10-RELEASE-94d66e09eb89 (64 bit)
.NET runtime version: 4.0.30319.18444+
Time: 2015-02-12 16:09:53 -05:00
OS: Windows 7 Service Pack 1 (x64) 6.1 build 7601 revision 10000
GDI object count: 106
User object count: 54
Surface count: 1
Exception: System.ArgumentException
Message: Illegal characters in path.

Stack:
at System.IO.Path.Combine(String path1, String path2)
at Greenshot.Destinations.FileDestination.ExportCapture(Boolean manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
at Greenshot.Helpers.CaptureHelper.HandleCapture()
at Greenshot.Helpers.CaptureHelper.CaptureWithFeedback()
at Greenshot.Helpers.CaptureHelper.MakeCapture()
at Greenshot.Helpers.CaptureHelper.CaptureRegion(Boolean captureMouse)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()

Configuration dump:
[Core]
Language=en-US
RegionHotkey=None
WindowHotkey=None
FullscreenHotkey=None
LastregionHotkey=Shift + PrintScreen
IEHotkey=Ctrl + Shift + PrintScreen
IsFirstLaunch=False
Destinations=FileNoDialog
ClipboardFormats=PNG,DIB
CaptureMousepointer=True
CaptureWindowsInteractive=False
CaptureDelay=100
ScreenCaptureMode=Auto
ScreenToCapture=1
WindowCaptureMode=Auto
WindowCaptureAllChildLocations=False
DWMBackgroundColor=Transparent
PlayCameraSound=True
ShowTrayNotification=False
OutputFilePath=C:\Kyle\Kyle Work\Photos\ScreenShots
OutputFileAllowOverwrite=True
OutputFileFilenamePattern=${YYYY}${MM}${DD} | ${hh}${mm}${ss}
OutputFileFormat=jpg
OutputFileReduceColors=False
OutputFileAutoReduceColors=False
OutputFileReduceColorsTo=256
OutputFileCopyPathToClipboard=False
OutputFileAsFullpath=C:\Kyle\Kyle Work\Photos\ScreenShots\2015-02-12 15_43_46.jpg
OutputFileJpegQuality=80
OutputFilePromptQuality=False
OutputFileIncrementingNumber=9
OutputPrintPromptOptions=True
OutputPrintAllowRotate=False
OutputPrintAllowEnlarge=False
OutputPrintAllowShrink=True
OutputPrintCenter=True
OutputPrintInverted=False
OutputPrintGrayscale=False
OutputPrintMonochrome=False
OutputPrintMonochromeThreshold=127
OutputPrintFooter=True
OutputPrintFooterPattern=${capturetime:d"D"} ${capturetime:d"T"} - ${title}
NotificationSound=default
UseProxy=True
IECapture=True
IEFieldCapture=False
WindowClassesToCheckForIE=AfxFrameOrView70,IMWindowClass
AutoCropDifference=10
IncludePlugins=
ExcludePlugins=
ExcludeDestinations=
UpdateCheckInterval=1
LastUpdateCheck=02/12/2015 14:57:42
DisableSettings=False
DisableQuickSettings=False
DisableTrayicon=False
HideExpertSettings=False
ThumnailPreview=True
NoGDICaptureForProduct=intellij idea
NoDWMCaptureForProduct=citrix ica client
OptimizeForRDP=False
MinimizeWorkingSetSize=False
WindowCaptureRemoveCorners=True
CheckForUnstable=False
ActiveTitleFixes=Firefox,IE,Chrome
TitleFixMatcher.Firefox= - Mozilla Firefox.*
TitleFixMatcher.IE= - (Microsoft|Windows) Internet Explorer.*
TitleFixMatcher.Chrome= - Google Chrome.*
TitleFixReplacer.Firefox=
TitleFixReplacer.IE=
TitleFixReplacer.Chrome=
EnableSpecialDIBClipboardReader=True
WindowCornerCutShape=5,3,2,1,1
LeftClickAction=SHOW_CONTEXT_MENU
DoubleClickAction=OPEN_LAST_IN_EXPLORER
ZoomerEnabled=True
ZoomerOpacity=1
MaxMenuItemLength=25
MailApiTo=
MailApiCC=
MailApiBCC=
OptimizePNGCommand=
OptimizePNGCommandArguments="{0}"
LastSaveWithVersion=1.2.4.10
ProcessEXIFOrientation=True
LastCapturedRegion=991, 322, 332, 340
WebRequestTimeout=10
WebRequestReadWriteTimeout=100
IconSize=16, 16

Environment

Win 7 64 bit

Gliffy Diagrams

Activity

Jens KlingenFebruary 18, 2015 at 9:32 PM

As of the next release, a decent error message will be shown if the problem occurs.
Additionally, the settings dialog will check the filename pattern for invalid characters, to avoid the invalid setting in the first place.

If you don't want to wait, an fresh unstable build should be availble in a few minutes here: http://getgreenshot.org/version-history/

Thanks again & best regards,
Jens

Kyle GerberFebruary 17, 2015 at 12:45 AM

You're welcome. Thanks for looking into it. The more I use GreenShot the more I love it. Please take a look at my feature request. If you are able to implement that it will be perfect!

Jens KlingenFebruary 16, 2015 at 10:27 PM

Ouch! Thanks for reporting this.

I agree. Even though the pipe character is indeed invalid in a Windows filename, we should definitely handle this in a more decent way. I will add a fix for the next version.

Best regards,
Jens

Fixed

Details

Assignee

Reporter

Affects versions

Priority

Created February 12, 2015 at 9:14 PM
Updated February 18, 2015 at 9:32 PM
Resolved February 18, 2015 at 9:32 PM