Skip to content

Commit d6c37ba

Browse files
author
Uwe Hees
committed
Merge remote-tracking branch 'laullon/master'
2 parents 636068c + e3304fa commit d6c37ba

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

English.lproj/RepositoryWindow.xib

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
33
<data>
44
<int key="IBDocument.SystemTarget">1050</int>
5-
<string key="IBDocument.SystemVersion">10J869</string>
6-
<string key="IBDocument.InterfaceBuilderVersion">1305</string>
5+
<string key="IBDocument.SystemVersion">10J3331a</string>
6+
<string key="IBDocument.InterfaceBuilderVersion">1306</string>
77
<string key="IBDocument.AppKitVersion">1038.35</string>
88
<string key="IBDocument.HIToolboxVersion">461.00</string>
99
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
1010
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
11-
<string key="NS.object.0">1305</string>
11+
<string key="NS.object.0">1306</string>
1212
</object>
1313
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
1414
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -63,7 +63,7 @@
6363
<nil key="NSToolbarDelegate"/>
6464
<bool key="NSToolbarPrefersToBeShown">YES</bool>
6565
<bool key="NSToolbarShowsBaselineSeparator">YES</bool>
66-
<bool key="NSToolbarAllowsUserCustomization">NO</bool>
66+
<bool key="NSToolbarAllowsUserCustomization">YES</bool>
6767
<bool key="NSToolbarAutosavesConfiguration">YES</bool>
6868
<int key="NSToolbarDisplayMode">1</int>
6969
<int key="NSToolbarSizeMode">1</int>

GLFileView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
- (void)showFile;
3232
- (void)didLoad;
3333
- (NSString *)parseBlame:(NSString *)txt;
34-
+ (NSString *)parseHTML:(NSString *)txt;
34+
+ (NSString *)escapeHTML:(NSString *)txt;
3535
+ (NSString *)parseDiff:(NSString *)txt;
3636
+ (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats;
3737
+ (NSString *)getFileName:(NSString *)line;

GLFileView.m

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ - (void) showFile
110110
if(startFile==@"fileview"){
111111
fileTxt=[file textContents:&theError];
112112
if(!theError)
113-
fileTxt=[GLFileView parseHTML:fileTxt];
113+
fileTxt=[GLFileView escapeHTML:fileTxt];
114114
}else if(startFile==@"blame"){
115115
fileTxt=[file blame:&theError];
116116
if(!theError)
@@ -240,13 +240,16 @@ - (void)closeView
240240
[super closeView];
241241
}
242242

243-
+ (NSString *) parseHTML:(NSString *)txt
243+
+ (NSString *) escapeHTML:(NSString *)txt
244244
{
245-
txt=[txt stringByReplacingOccurrencesOfString:@"&" withString:@"&amp;"];
246-
txt=[txt stringByReplacingOccurrencesOfString:@"<" withString:@"&lt;"];
247-
txt=[txt stringByReplacingOccurrencesOfString:@">" withString:@"&gt;"];
245+
NSMutableString *newTxt = [NSMutableString stringWithString:txt];
246+
[newTxt replaceOccurrencesOfString:@"&" withString:@"&amp;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
247+
[newTxt replaceOccurrencesOfString:@"<" withString:@"&lt;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
248+
[newTxt replaceOccurrencesOfString:@">" withString:@"&gt;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
249+
[newTxt replaceOccurrencesOfString:@"\"" withString:@"&quot;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
250+
[newTxt replaceOccurrencesOfString:@"'" withString:@"&apos;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
248251

249-
return txt;
252+
return newTxt;
250253
}
251254

252255
+ (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats
@@ -296,7 +299,7 @@ + (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)sta
296299

297300
+ (NSString *)parseDiff:(NSString *)txt
298301
{
299-
txt=[self parseHTML:txt];
302+
txt=[self escapeHTML:txt];
300303

301304
NSMutableString *res=[NSMutableString string];
302305
NSScanner *scan=[NSScanner scannerWithString:txt];
@@ -504,7 +507,7 @@ +(BOOL)isStartBlock:(NSString *)line
504507

505508
- (NSString *) parseBlame:(NSString *)txt
506509
{
507-
txt=[GLFileView parseHTML:txt];
510+
txt=[GLFileView escapeHTML:txt];
508511

509512
NSArray *lines = [txt componentsSeparatedByString:@"\n"];
510513
NSString *line;

PBGitSidebarController.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,11 @@ - (void) updateRemoteControls
522522
// get config
523523
BOOL hasSVN = [repository hasSvnRemote];
524524
[svnFetchButton setEnabled:hasSVN];
525+
[svnFetchButton setHidden:!hasSVN];
525526
[svnRebaseButton setEnabled:hasSVN];
527+
[svnRebaseButton setHidden:!hasSVN];
526528
[svnDcommitButton setEnabled:hasSVN];
529+
[svnDcommitButton setHidden:!hasSVN];
527530
}
528531

529532
- (IBAction) fetchPullPushAction:(id)sender

PBWebHistoryController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ - (NSString *)parseHeader:(NSString *)txt withRefs:(NSString *)badges
167167
}
168168
}else{
169169
if (subj) {
170-
[subject appendString:[NSString stringWithFormat:@"%@<br/>",[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]];
170+
NSString *trimmedLine = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
171+
[subject appendString:[NSString stringWithFormat:@"%@<br/>",[GLFileView escapeHTML:trimmedLine]]];
171172
}else{
172173
NSArray *comps=[line componentsSeparatedByString:@" "];
173174
if([comps count]==2){

0 commit comments

Comments
 (0)